I\'m using Angular2 Final release (2.1.0). When I want to display a list of companies, I got this error.
in file.component.ts
:
public
For Angular 10:
Failing to do step 2 will trigger this error!
Make sure to RESTART ng serve !!!
Future Readers
Check each of the following:
import { CommonModule } from '@angular/common';
ng serve
)I had the same error but I had the CommonModule imported. Instead I left a comma where it shouldn't be because of copy/paste when splitting a module:
@NgModule({
declarations: [
ShopComponent,
ShoppingEditComponent
],
imports: [
CommonModule,
FormsModule,
RouterModule.forChild([
{ path: 'shop', component: ShopComponent }, <--- offensive comma
])
]
})
In my case, the issue was that my teammate mentioned *ngfor
in templates instead of *ngFor
. Strange that there is no correct error to handle this issue (In Angular 4).