如何在 angular 4 中直接在模板绑定中增加变量?

How to increment variable directly in template binding in angular 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/>

我的问题是,有没有办法在模板绑定中为 ngfor 中的每个元素创建一个局部变量并将其递增 30?而不是有方法来进行递增?

我从方法中递增变量时遇到的问题是出现以下错误:

Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked

<ng-template ngFor let-person="$implicit" let-variable [ngForOf]="people" let-i="index">
  <p *ngIf="i == 0">{{variable + 30}}</p>
  <p *ngIf="i > 0">{{variable + (30*i)}}</p>
<ng-template/>

这样你就得到了从0开始到总长度的索引。