angular报错信息之Can't bind to 'ngForOf' since it isn't a known property of 'tr'. ("
//无法绑定到“ngforof”,因为它不是“tr”的已知属性。(“
当前错误原因是没有绑定ngforof
,在@ngmodule()
中添加browsermodule
到imports:[]
,如果它是根模块(appmodule)
,则为commonmodule
。
vendor.js:30013 Uncaught Error: Template parse errors:
Can't bind to 'ngForOf' since it isn't a known property of 'tr'. ("
</div>
<tbody>
<tr [ERROR ->]ngFor="let item of companies; let i =index">
<td>{{i}}</td>
"): ng:///AppRoutingModule/ZmzSelectComponent.html@57:22
Property binding ngForOf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("
</div>
<tbody>
[ERROR ->] <td>{{i}}</td>
"): ng:///AppRoutingModule/ZmzSelectComponent.html@57:18
at syntaxError (vendor.js:30013)
at TemplateParser.parse (vendor.js:42980)
at JitCompiler._parseTemplate (vendor.js:51606)
at JitCompiler._compileTemplate (vendor.js:51594)
at vendor.js:51538
at Set.forEach (<anonymous>)
at JitCompiler._compileComponents (vendor.js:51538)
at vendor.js:51451
at Object.then (vendor.js:30004)
at JitCompiler._compileModuleAndComponents (vendor.js:51450)
出现此问题是你的组件顺序有误,修改BrowserModule在控制器的位置
import {BrowserModule, CommonModule} from '@angular/common';
..
..
@NgModule({
imports: [BrowserModule, / or CommonModule /],
..
})
本文地址:https://www.zhuimengzhu.com/details/205.html
转载地址:暂无
转载说明:转载时请在文首注明来源zhuimengzhu.com 及教程作者,并附本文链接。谢谢各位编辑同仁配合。zhuimengzhu 保留追究相应责任的权利。