启动Angular应用程序时出现以下错误,即使未显示该组件也是如此.
我必须注释掉,以便我的应用程序正常运行.
zone.js:461 Unhandled Promise rejection: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'input'. ("
<div>
<label>Created:</label>
<input type="text" [ERROR ->][(ngModel)]="test" placeholder="foo" />
</div>
</div>"): InterventionDetails@4:28 ; Zone: <root> ; Task: Promise.then ; Value:
Run Code Online (Sandbox Code Playgroud)
我正在看着英雄的掠夺者,但我没有看到任何区别.
这是组件文件:
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Intervention } from '../../model/intervention';
@Component({
selector: 'intervention-details',
templateUrl: 'app/intervention/details/intervention.details.html',
styleUrls: ['app/intervention/details/intervention.details.css']
})
export class InterventionDetails
{
@Input() intervention: Intervention;
public test : string = "toto"; …Run Code Online (Sandbox Code Playgroud) 我是Angular 2\4中的新手,我正在尝试按照这个快速视频教程将PrimeNG组件添加到我的Angular项目中:
https://www.youtube.com/watch?v=6Nvze0dhzkE
以及PrimeNG教程页面的入门部分:https://www.primefaces.org/primeng/#/setup
所以这是我的app.component.html看法:
<!--The whole content below can be removed with the new code.-->
<div style="text-align:center">
<h1>
Welcome to {{title}}!!
</h1>
</div>
<p-calendar [(ngModel)]="value"></p-calendar>
{{value | date:'dd.mm.yyy'}}
Run Code Online (Sandbox Code Playgroud)
如您所见,我已插入此标记以显示日历组件:
<p-calendar [(ngModel)]="value"></p-calendar>
Run Code Online (Sandbox Code Playgroud)
(如该组件的官方文档所示:https://www.primefaces.org/primeng/#/calendar)
这里我有第一个问题因为IntelliJ给我这个错误信息:
Error:(9, 13) Angular: Can't bind to 'ngModel' since it isn't a known property of 'p-calendar'.
1. If 'p-calendar' is an Angular component and it has 'ngModel' input, then verify that it is …Run Code Online (Sandbox Code Playgroud)