refactor(core): remove deprecated @Component.directives and @Component.pipes
BREAKING CHANGE: previously deprecated @Component.directives and @Component.pipes support was removed. All the components and pipes now must be declarated via an NgModule. NgModule is the basic compilation block passed into the Angular compiler via Compiler#compileModuleSync or #compileModuleAsync. Because of this change, the Compiler#compileComponentAsync and #compileComponentSync were removed as well - any code doing compilation should compile module instead using the apis mentioned above. Lastly, since modules are the basic compilation unit, the ngUpgrade module was modified to always require an NgModule to be passed into the UpgradeAdapter's constructor - previously this was optional.
This commit is contained in:
@ -304,11 +304,23 @@ export class PlatformRef_ extends PlatformRef {
|
||||
}
|
||||
|
||||
private _bootstrapModuleWithZone<M>(
|
||||
moduleType: Type<M>, compilerOptions: CompilerOptions|CompilerOptions[] = [],
|
||||
ngZone: NgZone): Promise<NgModuleRef<M>> {
|
||||
moduleType: Type<M>, compilerOptions: CompilerOptions|CompilerOptions[] = [], ngZone: NgZone,
|
||||
componentFactoryCallback?: any): Promise<NgModuleRef<M>> {
|
||||
const compilerFactory: CompilerFactory = this.injector.get(CompilerFactory);
|
||||
const compiler = compilerFactory.createCompiler(
|
||||
compilerOptions instanceof Array ? compilerOptions : [compilerOptions]);
|
||||
|
||||
// ugly internal api hack: generate host component factories for all declared components and
|
||||
// pass the factories into the callback - this is used by UpdateAdapter to get hold of all
|
||||
// factories.
|
||||
if (componentFactoryCallback) {
|
||||
return compiler.compileModuleAndAllComponentsAsync(moduleType)
|
||||
.then(({ngModuleFactory, componentFactories}) => {
|
||||
componentFactoryCallback(componentFactories);
|
||||
return this._bootstrapModuleFactoryWithZone(ngModuleFactory, ngZone);
|
||||
});
|
||||
}
|
||||
|
||||
return compiler.compileModuleAsync(moduleType)
|
||||
.then((moduleFactory) => this._bootstrapModuleFactoryWithZone(moduleFactory, ngZone));
|
||||
}
|
||||
|
Reference in New Issue
Block a user