Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't bind to 'ngIf' since it isn't a known property of 'div'. (NOT DUPLICATE) [duplicate]

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'. ("

like image 567
Jimi Avatar asked Nov 27 '16 10:11

Jimi


1 Answers

In your module add

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

@NgModule({
    imports: [
        CommonModule
    ]
})
like image 58
Piotr Ptak Avatar answered Oct 21 '22 00:10

Piotr Ptak