NG0303: Can't bind to 'ngIf' since it isn't a known property of 'div'. code example

Example 1: core.js:7813 Can't bind to 'ngIf' since it isn't a known property of 'div'

import { CommonModule } from '@angular/common';  
import { BrowserModule } from '@angular/platform-browser';

Example 2: core.js:7813 Can't bind to 'ngIf' since it isn't a known property of 'div'

@NgModule({
    imports: [CommonModule],
    declarations: [MyComponent]
  ...
})
class MyComponentModule {}

Example 3: NG0303: Can't bind to 'ngIf' since it isn't a known property of 'form'.

// If you are using RC5 then import this:

import { CommonModule } from '@angular/common';  
import { BrowserModule } from '@angular/platform-browser';

// and be sure to import CommonModule from the module that is providing your component.

 @NgModule({
    imports: [CommonModule],
    declarations: [MyComponent]
  ...
})
class MyComponentModule {}

Tags:

Misc Example