refactor(core): introduce NgModule.schemas
This allows Angular to error on unknown properties, allowing applications that don’t use custom elements to get better error reporting. Part of #10043 BREAKING CHANGE: - By default, Angular will error during parsing on unknown properties, even if they are on elements with a `-` in their name (aka custom elements). If you application is using custom elements, fill the new parameter `@NgModule.schemas` with the value `[CUSTOM_ELEMENTS_SCHEMA]`. E.g. for bootstrap: ``` bootstrap(MyComponent, {schemas: [CUSTOM_ELEMENTS_SCHEMA]}); ```
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import * as common from '@angular/common';
|
||||
import {Component, Inject, OpaqueToken} from '@angular/core';
|
||||
import {CUSTOM_ELEMENTS_SCHEMA, Component, Inject, NgModule, OpaqueToken} from '@angular/core';
|
||||
|
||||
import {wrapInArray} from './funcs';
|
||||
|
||||
@ -37,3 +37,16 @@ export class CompWithProviders {
|
||||
})
|
||||
export class CompWithReferences {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'cmp-custom-els',
|
||||
template: `
|
||||
<some-custom-element [someUnknownProp]="true"></some-custom-element>
|
||||
`,
|
||||
})
|
||||
export class CompUsingCustomElements {
|
||||
}
|
||||
|
||||
@NgModule({schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [CompUsingCustomElements]})
|
||||
export class ModuleUsingCustomElements {
|
||||
}
|
||||
|
Reference in New Issue
Block a user