Can't bind to 'ngIf' since it isn't a known property of 'div' in production build
After adding browser module its working fine.
import { BrowserModule } from '@angular/platform-browser';
@NgModule({
imports: [BrowserModule ]
})
I had exactly the same error, and I had included both CommonModule and BrowserModule and yet I still saw the same error message on my browser.
Finally, I found the cause of my problem was that I forgot to add my component to app.module.ts, in case someone else is dealing with the same behavior.
Other solution if none of the above works is just to restart your ng serve
, that worked for me. Or maybe try this method first before pulling your hairs out.