1

Ng2-datepicker (1.0.6) Angular2 (2.0.0-rc.5)

When i try to use it in html as in their docs i got this error:

    zone.js:484 Unhandled Promise rejection: Template parse errors:
    Can't bind to 'ngModel' since it isn't a known property of 'datepicker'.
    ("
    </div>
    <div class="form-input">
        <datepicker [ERROR ->][(ngModel)]="notice.date"></datepicker>
    </div>
  </div>
    "): AddNoticeComponent@17:24 ; Zone: <root> ; Task: Promise.then ; Value: 
Arnaud Denoyelle
  • 29,980
  • 16
  • 92
  • 148
Victor
  • 13
  • 3

2 Answers2

0

Add it to declarations: [...] of an @NgModule() and also add imports: [CommonModule, FormsModule, ReactiveFormsModule] to this @NgModule()

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • Thanks to your answer i found that actually the problem is not in connecting Ng2-Datepicker, but in the NgModel itself. I tried solutions described [here](http://stackoverflow.com/questions/38892771/cant-bind-to-ngmodel-since-it-isnt-a-known-property-of-input) and nothing helps. – Victor Sep 16 '16 at 08:43
  • 1
    Actually a complete wipe of node_modules and after 'npm install' it works correct. – Victor Sep 16 '16 at 09:11
0

Please add below code in .ts file

import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
@NgModule({
  declarations: [
  ],
  imports: [   
    FormsModule,
    HttpModule,
  ],
})
Pac0
  • 21,465
  • 8
  • 65
  • 74