I have just installed a bearbones ng2 app using the ng2 cli. In my AppModule
I added schema: [ CUSTOM_ELEMENTS_SCHEMA ]
, and in my AppComponent
template I have <row></row>
. But I'm getting-
Unhandled 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>
It's really that simple. What the heck is going on?
Edit:
All of the answers below are satisfactory and provide insight into the problem. @yurzui I especially like your answer for providing the source. I wish I could give you all the accepted answer! But I will choose @camaron for being the first and giving the direct solution to my problem. If you find this question via google please give @yurzui, @camaron, and @Aravind a +1 for helping with this issue!
You need to add the RowComponent
to be imported by your AppModule
imports: [RowComponent]
Edit:
Use NO_ERRORS_SCHEMA
, this is because angular is trying to find an component that doesn't exists.
CUSTOM_ELEMENTS_SCHEMA
is for components with a -
in the selector name.