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:
@ -12,6 +12,7 @@
|
||||
* allows tests to be asynchronous by either returning a promise or using a 'done' parameter.
|
||||
*/
|
||||
|
||||
import {SchemaMetadata} from '../index';
|
||||
import {TestBed, getTestBed} from './test_bed';
|
||||
|
||||
declare var global: any;
|
||||
@ -49,9 +50,13 @@ export function addProviders(providers: Array<any>): void {
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export function configureModule(
|
||||
moduleDef: {providers?: any[], declarations?: any[], imports?: any[], entryComponents?: any[]}):
|
||||
void {
|
||||
export function configureModule(moduleDef: {
|
||||
providers?: any[],
|
||||
declarations?: any[],
|
||||
imports?: any[],
|
||||
entryComponents?: any[],
|
||||
schemas?: Array<SchemaMetadata|any[]>
|
||||
}): void {
|
||||
if (!moduleDef) return;
|
||||
try {
|
||||
testBed.configureModule(moduleDef);
|
||||
|
Reference in New Issue
Block a user