*ngFor is not working in angular 2

后端 未结 1 1385
长情又很酷
长情又很酷 2021-01-19 02:46

app.module.ts

import { NgModule }       from \'@angular/core\';
import { BrowserModule }  from \'@angular/platform-browser\';
import { Forms         


        
相关标签:
1条回答
  • 2021-01-19 03:21

    You probably created another module and declared component you are using there, but you forgot to import CommonModule which provides common directives such as *ngIf and *ngFor. You don't need to do this in your AppModule because you import BrowserModule there which exports CommonModule, so these directives are available in AppModule.

    0 讨论(0)
提交回复
热议问题