Can't bind to 'ngIf' since it isn't a known property of 'div'

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 {}

Just for anyone who still has an issue, I also had an issue where I typed ngif rather than ngIf (notice the capital 'I').


Instead of [ngIf] you should use *ngIf like this:

<div *ngIf="isAuth" id="sidebar">

Tags:

Angular