它又是我....我在视图中显示我的项目数组时遇到问题,我总是遇到这个错误.[Unhandled Promise rejection:无法设置未定义的属性'stack'; 区域:; 任务:Promise.then; 值:TypeError:无法设置未定义的属性'stack']
也许我在html视图中绑定数据时做错了.
ngOnInit() : void{
this._loadCoil.getAllCoils().subscribe(coils =>{ this.coils = coils;
this.gridData = {
data: this.coils.slice(this.currentPage, this.currentPage + this.displaySize),
total: this.coils.length};
for(let i = 0; i < this.coils.length; i++){
let isFound = false;
for (let j = 0; j < this.dropDownArray.length; j++){
if (this.dropDownArray[j] == this.coils[i].unit){
isFound = true;
break;
}
}
if(!isFound){
this.dropDownArray.push(this.coils[i].unit);
}
}
});
}
基本上我想用我的数组填充单位名称并在网站上显示它们.(这部分工作正常)
但是,当我想在页面上打印名称时,我得到前面提到的.这是我在html页面中的代码片段
- {{name}}