Angular 有角度组件的问题
我知道这是一个现有的线程:,但这并不能解决我的问题 我这里也有同样的问题 我正试图找出Angular Cli-成功创建了一个新项目,并添加了组件。以上帖子中的所有提示都会自动实现 尝试使用所表示的组件(向模板中添加)时,出现以下错误:Angular 有角度组件的问题,angular,components,angular-cli,Angular,Components,Angular Cli,我知道这是一个现有的线程:,但这并不能解决我的问题 我这里也有同样的问题 我正试图找出Angular Cli-成功创建了一个新项目,并添加了组件。以上帖子中的所有提示都会自动实现 尝试使用所表示的组件(向模板中添加)时,出现以下错误: Unhandled Promise rejection: Template parse errors: 'superman' is not a known element: 1. If 'superman' is an Angular component, the
Unhandled Promise rejection: Template parse errors:
'superman' is not a known element:
1. If 'superman' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("<h1>
{{title}}
[ERROR ->]<superman></superman>
</h1>
"):
未处理的承诺拒绝:模板分析错误:
“超人”不是已知的元素:
1.如果“超人”是一个角度组件,则确认它是该模块的一部分。
2.若要允许任何元素,请将“无错误模式”添加到此组件的“@NgModule.schemas”。("
{{title}}
[错误->]
"):
您需要在模块中注册该组件。请看下面的答案
e、 g
如果我使用,选择器是否可以是“超级组件”?框架公约?这对我来说真是太烦人了,叫这么多东西:)
@NgModule({
imports: [BrowserModule],
declarations: [AppComponent, SupermanComponent], //<----here
providers: [],
bootstrap: [AppComponent]
})
@Component({
selector: 'superman',
template: '...'
...
})
export class SupermanComponent { ...