@NgModule({
imports: [CommonModule,NgbModule.forRoot()],
declarations: [TestComponent],
exports: [TestComponent]
})
组件--
导出类TestComponent实现OnInit{
模型:NGBDateStruct;
@NgModule({
imports: [SharedModule,LoginRoutingModule,TestModule],
declarations: [LoginComponent],
})
<app-test></app-test>
error_handler.js:47EXCEPTION: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'ngb-datepicker'.
1. If 'ngb-datepicker' is an Angular component and it has 'ngModel' input, then verify that it is part of this module.
2. If 'ngb-datepicker' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
("
<ngb-datepicker #dp [ERROR ->][(ngModel)]="model"></ngb-datepicker>
"): TestComponent@1:22ErrorHandler.handleError @ error_handler.js:47next @ application_ref.js:272schedulerFn @ async.js:82SafeSubscriber.__tryOrUnsub @ Subscriber.js:223SafeSubscriber.next @ Subscriber.js:172Subscriber._next @ Subscriber.js:125Subscriber.next @ Subscriber.js:89Subject.next @ Subject.js:55EventEmitter.emit @ async.js:74onError @ ng_zone.js:119onHandleError @ ng_zone_impl.js:64ZoneDelegate.handleError @ zone.js:207Zone.runGuarded @ zone.js:113_loop_1 @ zone.js:379drainMicroTaskQueue @ zone.js:386
error_handler.js:52ORIGINAL STACKTRACE:ErrorHandler.handleError @ error_handler.js:52next @ application_ref.js:272schedulerFn @ async.js:82SafeSubscriber.__tryOrUnsub @ Subscriber.js:223SafeSubscriber.next @ Subscriber.js:172Subscriber._next @ Subscriber.js:125Subscriber.next @ Subscriber.js:89Subject.next @ Subject.js:55EventEmitter.emit @ async.js:74onError @ ng_zone.js:119onHandleError @ ng_zone_impl.js:64ZoneDelegate.handleError @ zone.js:207Zone.runGuarded @ zone.js:113_loop_1 @ zone.js:379drainMicroTaskQueue @ zone.js:386
error_handler.js:53Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'ngb-datepicker'.
1. If 'ngb-datepicker' is an Angular component and it has 'ngModel' input, then verify that it is part of this module.
2. If 'ngb-datepicker' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
("
<ngb-datepicker #dp [ERROR ->][(ngModel)]="model"></ngb-datepicker>
"): TestComponent@1:22
at resolvePromise (zone.js:429)
at zone.js:406
at ZoneDelegate.invoke (zone.js:203)
at Object.onInvoke (ng_zone_impl.js:43)
at ZoneDelegate.invoke (zone.js:202)
at Zone.run (zone.js:96)
at zone.js:462
at ZoneDelegate.invokeTask (zone.js:236)
at Object.onInvokeTask (ng_zone_impl.js:34)
at ZoneDelegate.invokeTask (zone.js:235)ErrorHandler.handleError @ error_handler.js:53next @ application_ref.js:272schedulerFn @ async.js:82SafeSubscriber.__tryOrUnsub @ Subscriber.js:223SafeSubscriber.next @ Subscriber.js:172Subscriber._next @ Subscriber.js:125Subscriber.next @ Subscriber.js:89Subject.next @ Subject.js:55EventEmitter.emit @ async.js:74onError @ ng_zone.js:119onHandleError @ ng_zone_impl.js:64ZoneDelegate.handleError @ zone.js:207Zone.runGuarded @ zone.js:113_loop_1 @ zone.js:379drainMicroTaskQueue @ zone.js:386
zone.js:355Unhandled Promise rejection: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'ngb-datepicker'.
1. If 'ngb-datepicker' is an Angular component and it has 'ngModel' input, then verify that it is part of this module.
2. If 'ngb-datepicker' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
("
<ngb-datepicker #dp [ERROR ->][(ngModel)]="model"></ngb-datepicker>
"): TestComponent@1:22 ; Zone: angular ; Task: Promise.then ; Value: Error: Template parse errors:(…) Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'ngb-datepicker'.
1. If 'ngb-datepicker' is an Angular component and it has 'ngModel' input, then verify that it is part of this module.
2. If 'ngb-datepicker' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
("
<ngb-datepicker #dp [ERROR ->][(ngModel)]="model"></ngb-datepicker>
"): TestComponent@1:22
at TemplateParser.parse (http://localhost:4200/main.bundle.js:18077:19)
at RuntimeCompiler._compileTemplate (http://localhost:4200/main.bundle.js:42938:51)
at http://localhost:4200/main.bundle.js:42860:83
at Set.forEach (native)
at compile (http://localhost:4200/main.bundle.js:42860:47)
at ZoneDelegate.invoke (http://localhost:4200/main.bundle.js:99970:28)
at Object.onInvoke (http://localhost:4200/main.bundle.js:71761:37)
at ZoneDelegate.invoke (http://localhost:4200/main.bundle.js:99969:34)
at Zone.run (http://localhost:4200/main.bundle.js:99863:43)
at http://localhost:4200/main.bundle.js:100229:57consoleError @ zone.js:355_loop_1 @ zone.js:382drainMicroTaskQueue @ zone.js:386
zone.js:357Error: Uncaught (in promise): Error: Template parse errors:(…)consoleError @ zone.js:357_loop_1 @ zone.js:382drainMicroTaskQueue @ zone.js:386
你错过了Formsmodule。试着像这样导入-
import {FormsModule} from '@angular/forms';
并像这样在AppModule中使用它-
@NgModule({
imports: [ BrowserModule, FormsModule, NgbModule ],
您也可以像这样使用ngbDatepicker-
<input class="form-control" placeholder="yyyy-mm-dd" name="dp1" [(ngModel)]="newItem.EndTime" ngbDatepicker #d1="ngbDatepicker" required>
我的html模态组件中有以下代码: 但是我得到了以下错误: 我在网上看过其他人的解决方案,他们建议导入表单模块、反应式表单模块和通用模块,但我已经在模式模块中导入了这些解决方案 有没有人对我如何摆脱这个错误还有其他建议?
我正在尝试在表中显示来自数据库的一些数据,我遇到了这个错误,我在网上找到的唯一解决方案是导入通用模块和NgModule,我已经在做了,所以我不明白出了什么问题。这只发生在这个组件中,而不是在同一个模块中的其他组件中: 我收到的数据: admin.component.ts: 管理组成部分html:
我正在使用Angular 6并试图呈现一个页面,我得到以下错误不能绑定到'ng模型',因为它不是'input'的已知属性。我已经尝试了堆栈溢出中的所有选项。 以下是选择 app.module.ts 我使用的是Visual Studio代码,当我点击一个特定的链接时,我得到了错误。请指导我。提前谢谢。
我试图在Angular 2中实现动态表单。我在动态表单中添加了删除和取消等附加功能。我遵循了以下文档:https://angular.io/docs/ts/latest/cookbook/dynamic-form.html 我对代码做了一些修改。我在这里搞错了。 我如何使这个错误消失? 您可以在这里找到完整的代码:http://plnkr.co/edit/sl949g1hqqrnrur1xxqt?
我试图在这里遵循基本的Angular 2教程: https://angular.io/docs/js/latest/guide/displaying-data.html 我可以让angular应用程序加载并显示我的名字,代码如下: 但是,当我尝试添加字符串数组并尝试使用ng for显示它们时,它会抛出以下错误: 以下是代码: 我错过了什么?
我做错了什么? 错误是