我声明了一个全局变量,它的值在for循环内更改, 但是当我在.html视图中访问该变量时,它正在获取glolbal变量,而不是该可变参数的更改值
Event_count:any = [];
getStoreInformationValues(){
this._dataService.getStoreInfo().subscribe(
(result1 )=>
{
this.Store_data=result1;
for( let i=0;i<this.Store_data.length;i++){
this.Jsonobj3=this.Store_data[i];
this.Event_count[0]=this.Jsonobj3['store_no']
}
console.log("store data" ,this.Store_data);
console.log("event count value" +this.Event_count);
},
(error)=>{
})
//查看代码
{{Event_count}} //it is picking the global value