export class DemoComponent implements OnInit {
public Qid;
public token;
public data
constructor(public CommonComponentService: CommonComponentService){}
ngOnInit(){
this.token = window.localstorage.getItem('token);
this.CommonComponentService.kalchachaniQuestion('apiUrl', this.token)
.subscribe(
data => {
this.data = data.lenght;
this.Qid = 140 - this.data;
})
}
}

<div *ngFor="let Q of questions; let i = Qid;">
{{Q}} - {{i}}
</div>
&#13;
你好在上面的例子中假设我从服务器获取数据数组。无论我得到多少数据数组,我都在做一些数学运算&amp;现在将结果存储在Qid变量中我想使用&#34; Qid作为我的ngFor&#34;中的索引。 我该如何实现呢?提前谢谢你