-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: lifecycle hooksfreq1: lowregressionIndicates than the issue relates to something that worked in a previous versionIndicates than the issue relates to something that worked in a previous versionstate: confirmedtype: bug/fix
Milestone
Description
🐞 bug report
Affected Package
The issue is caused by package @angular/compiler-cli (I guess)Is this a regression?
I had never tried AoT with IvyDescription
I have a custom property decorator like this:export function Language(): PropertyDecorator {
function DecoratorFactory(target: any): void {
const targetNgOnInit: () => void = target.ngOnInit;
function ngOnInit(this: any): void {
// Just for example
console.log('onInit');
if (targetNgOnInit) {
targetNgOnInit.apply(this);
}
}
target.ngOnInit = ngOnInit;
}
return DecoratorFactory;
}
used as:
@Language() lang: string;
ngOnInit() {
// For aot
}
- With AoT compiler, it works (it writes onInit in console)
- If I enable Ivy and disable AoT, it works
- If I enable Ivy and AoT, it doesn't work
🔬 Minimal Reproduction
🔥 Exception or Error
No errors during compilation or in console. The ngOnInit method in decorator function is ignored.
🌍 Your Environment
Angular Version:
Angular CLI: 8.1.1
Node: 10.14.2
OS: win32 x64
Angular: 8.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.801.1
@angular-devkit/build-angular 0.801.1
@angular-devkit/build-optimizer 0.801.1
@angular-devkit/build-webpack 0.801.1
@angular-devkit/core 8.1.1
@angular-devkit/schematics 8.1.1
@ngtools/webpack 8.1.1
@schematics/angular 8.1.1
@schematics/update 0.801.1
rxjs 6.4.0
typescript 3.4.5
webpack 4.35.2
Anything else relevant?
Tried without success also the next version of Angular.
Thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: lifecycle hooksfreq1: lowregressionIndicates than the issue relates to something that worked in a previous versionIndicates than the issue relates to something that worked in a previous versionstate: confirmedtype: bug/fix