1

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

当我尝试像在他们的文档中那样在 html 中使用它时,我收到了这个错误:

    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: 
4

2 回答 2

0

将其添加到declarations: [...]an@NgModule()并添加imports: [CommonModule, FormsModule, ReactiveFormsModule]到此@NgModule()

于 2016-09-14T07:50:49.043 回答
0

请在 .ts 文件中添加以下代码

import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
@NgModule({
  declarations: [
  ],
  imports: [   
    FormsModule,
    HttpModule,
  ],
})
于 2017-12-12T07:01:55.257 回答