Angular - NgIf not working on component: "NG0303: Can't bind to 'ngIf' since it isn't a known property of 'p'."

I guess this is a possible duplicate nevertheless you should import

CommonModule and BrowserModule

under the module of your component and if you are not sure just add it the app.module.ts file like this :

1 Imports :

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

2 Under NgModule :

@NgModule({
  imports: [
    CommonModule,
    BrowserModule
...