angular报错信息之 Can't bind to 'ngForOf' since it isn't a known property of 'tr'. ("

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'. ("
                
                                   ]*ngFor="let item of companies; let i =index">                      {{i}}                  "): 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". ("                 
                                   [ERROR ->]                      {{i}}              "): 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 ()     at JitCompiler._compileComponents (vendor.js:51538)     at vendor.js:51451     at Object.then (vendor.js:30004)     at JitCompiler._compileModuleAndComponents (vendor.js:51450)

angular报错信息之 Can't bind to 'ngForOf' since it isn't a known property of 'tr'. (

解决方法:

出现此问题是你的组件顺序有误,修改BrowserModule在控制器的位置

import {BrowserModule, CommonModule} from '@angular/common';
..
..
@NgModule({
  imports: [BrowserModule, /* or CommonModule */],
  ..
})

你可能感兴趣的:(angular报错信息之 Can't bind to 'ngForOf' since it isn't a known property of 'tr'. (")