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:
@ -6,7 +6,8 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {SecurityContext} from '@angular/core';
|
||||
import {SchemaMetadata, SecurityContext} from '@angular/core';
|
||||
|
||||
import {ElementSchemaRegistry} from '../index';
|
||||
import {isPresent} from '../src/facade/lang';
|
||||
|
||||
@ -15,7 +16,7 @@ export class MockSchemaRegistry implements ElementSchemaRegistry {
|
||||
public existingProperties: {[key: string]: boolean},
|
||||
public attrPropMapping: {[key: string]: string}) {}
|
||||
|
||||
hasProperty(tagName: string, property: string): boolean {
|
||||
hasProperty(tagName: string, property: string, schemas: SchemaMetadata[]): boolean {
|
||||
var result = this.existingProperties[property];
|
||||
return isPresent(result) ? result : true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user