私は、次のオブジェクトがあります。角度4のテンプレート結合で変数を直接インクリメントする方法は?
this.people = [{
name: 'Douglas Pace',
title: 'Parcelivery Nailed The Efficiency',
content: 'Since I installed this app, its always help me book every tickets I need like flight, concert, ' +
'movie or hotel. I don\'t need to install different app for different ticket. The payment is also very easy',
image: '../../assets/img/profile_pics/profile_pic.jpg',
rate: '4.5',
classActive: 'testimonials__selected-visible',
active: true
},
{
name: 'Naseebullah Ahmadi',
title: 'Parcelivery Nailed The Efficiency',
content: 'Since I installed this app, its always help me book every tickets I need like flight, concert, ' +
'movie or hotel. I don\'t need to install different app for different ticket. The payment is also very easy',
image: '../../assets/img/profile_pics/profile_pic.jpg',
rate: '4.5',
classActive: '',
active: false
},
{
name: 'Haseebullah Ahmadi',
title: 'Parcelivery Nailed The Efficiency',
content: 'Since I installed this app, its always help me book every tickets I need like flight, concert, ' +
'movie or hotel. I don\'t need to install different app for different ticket. The payment is also very easy',
image: '../../assets/img/profile_pics/profile_pic.jpg',
rate: '4.5',
classActive: '',
active: false
}
];
を、私はそうのようなHTMLでこれをループしています:、
<ng-template ngFor let-person="$implicit" let-variable [ngForOf]="people">
{{variable + 30}}
<ng-template/>
私の質問があり、ローカル変数を持つと30で、それをインクリメントする方法がありますテンプレートバインディングのngfor内の各要素について?増分を行うメソッドを持つよりもむしろ?あなたは、全体の長さに0
から始まるインデックスを取得することにより、この
Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked
どのフィールドを増やす必要がありますか –
現在、増分するランダム変数を作成したいだけです。私はオブジェクトにフィールドを追加してそれを増やしたくない。これは私の質問をここに示すためのものです。しかし、私はオブジェクトを取得するAPIを使用しているので、私はそれを変更することはできません。 @ sachilaranawaka – James