如何使用angular 2制作自定义标记?
我有一个自定义组件的问题。问题在于,将其与模型[(ngModule)]=“值”链接,并给出如下错误:如何使用angular 2制作自定义标记?,angular,custom-element,custom-tags,Angular,Custom Element,Custom Tags,我有一个自定义组件的问题。问题在于,将其与模型[(ngModule)]=“值”链接,并给出如下错误: Unhandled Promise rejection: Template parse errors: Can't bind to 'ngModule' since it isn't a known property of 'gpi-input'. 1. If 'gpi-input' is an Angular component and it has 'ngModule' input, the
Unhandled Promise rejection: Template parse errors:
Can't bind to 'ngModule' since it isn't a known property of 'gpi-input'.
1. If 'gpi-input' is an Angular component and it has 'ngModule' input, then verify that it is part of this module.
2. If 'gpi-input' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
("
<div>
<h1>Input:</h1>
<gpi-input name="someValue" [ERROR ->][(ngModule)]="valueInput">
Escriu algu plis!!
</gpi-input>
应用程序组件:
import { Component } from '@angular/core';
import '../../public/css/styles.css';
@Component({
selector: 'my-app',
templateUrl: './src/app/app.component.html',
//styleUrls: ['./app.component.css']
})
export class AppComponent {
valueInput: string = "";
}
谁能告诉我问题出在哪里,或者给我一个什么问题的答案。谢谢!!=)
注:
我看到了社区自定义元素模式的其他问题,它将文件添加到shcemas中的app.module@NgModule,但问题仍然存在
问题不在于要显示的组件,而在于使用该组件的组件
<gpi-input name="someValue" [ERROR ->][(ngModule)]="valueInput">
Escriu algu plis!!
</gpi-input>
][(ngModule)]=“valueInput”>
埃斯克里乌·阿尔古·普利斯!!
[(ngModule)]
应该是[(ngModel)]
问题不在于您显示的组件,而是使用该组件的组件
<gpi-input name="someValue" [ERROR ->][(ngModule)]="valueInput">
Escriu algu plis!!
</gpi-input>
][(ngModule)]=“valueInput”>
埃斯克里乌·阿尔古·普利斯!!
[(ngModule)]
应该是[(ngModel)]
<gpi-input name="someValue" [ERROR ->][(ngModule)]="valueInput">
Escriu algu plis!!
</gpi-input>