我刚刚使用ng2 cli安装了一个bearbones ng2 app.在我的AppModule中,我添加了模式:[CUSTOM_ELEMENTS_SCHEMA],在我的AppComponent模板中,我有< row>< / row>.但我得到 –
原文链接:https://www.f2er.com/angularjs/141627.htmlUnhandled Promise rejection: Template parse errors:
‘row’ is not a known element:
1. If ‘row’ is an Angular component,then verify that it is part of this module.
2. If ‘row’ is a Web Component then add “CUSTOM_ELEMENTS_SCHEMA” to the ‘@NgModule.schemas’ of this component to suppress this message. (“[ERROR ->]
AppModule-
import { BrowserModule } from '@angular/platform-browser'; import { NgModule,CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ],imports: [ BrowserModule,FormsModule,HttpModule ],providers: [],bootstrap: [AppComponent],schemas: [ CUSTOM_ELEMENTS_SCHEMA ] }) export class AppModule { }
AppComponent-
import { Component } from '@angular/core'; @Component({ selector: 'app-root',templateUrl: './app.component.html',styleUrls: ['./app.component.css'] }) export class AppComponent {}
AppComponentTemplate-
<row></row>
这真的很简单.到底他妈发生了什么?
编辑:
以下所有答案都令人满意,并提供了对问题的深入了解. @yurzui我特别喜欢你提供源代码的答案.我希望我能给你所有接受的答案!但我会选择@camaron作为第一个并直接解决我的问题.如果你通过谷歌找到这个问题,请给@yurzui,@camaron和@Aravind一个1来帮助解决这个问题!