Angular2: Template parse errors: Add “CUSTOM_ELEMENTS_SCHEMA” to the ‘@NgModule.schemas’

Standard

With the new angular 2.0.0 final release (sept 14, 2016), if you use custom html tags then it will report that Template parse errors. A custom tag is a tag you use in your HTML that’s not one of these tags.

screenshot_2

Solution:

schemas: [ CUSTOM_ELEMENTS_SCHEMA ] need to be added to module where you are using custom HTML tags.

import { NgModule, CUSTOM_ELEMENTS_SCHEMA }  from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent }  from './app.component';

@NgModule({
    bootstrap: [AppComponent],
    declarations: [AppComponent],
    imports: [BrowserModule],
    schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class AppModule { }
Advertisements

2 thoughts on “Angular2: Template parse errors: Add “CUSTOM_ELEMENTS_SCHEMA” to the ‘@NgModule.schemas’

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s