13

Just upgraded to Angular 2.1. I have a @input value which I'm attempting to pass an array. As soon as I put *ngIf inside a template I get parse errors? If I print the input value I get: //[object Object],[object Object],[object Object]. Why is this affecting *ngIf?

<div *ngIf="< my value "></div>

-- error zone.js?fad3:388 Unhandled Promise rejection: Template parse errors: Can't bind to 'ngIf' since it isn't a known property of 'div'. ("

Jimi
  • 1,867
  • 7
  • 31
  • 55

1 Answers1

22

In your module add

import { CommonModule } from '@angular/common';

@NgModule({
    imports: [
        CommonModule
    ]
})
Piotr Ptak
  • 461
  • 6
  • 15
  • 9
    I have added commonmodule.. Still I am facing error. Its happening only in production bundle. Its working fine in locale – raj m Feb 06 '17 at 06:55
  • Also double-check if you were silly like me and named the module that contains common components `CommonModule` instead of the more...common `SharedModule`. – msanford Aug 22 '17 at 15:47