angular-cn/packages/upgrade/src
Pete Bacon Darwin c986d3dcf4 fix(upgrade): upgrade Directive facade should not return different instance from constructor (#27660)
In ngUpgrade (dynamic) we create a dynamic Angular `Directive` that wraps AngularJS components
that are being upgraded. The constructor of this `Directive` class returns a different instance
than `this`. It is this instance that actually contains the life-cycle hook handlers.

This would break in ivy, since the methods on the prototype of the original class are wired up,
rather than the instance methods. This results in hooks like `ngOnInit` not being called.

This commit refactors the code to extend the inner class that was being returned so that the
prototype chain is correct for both ViewEngine and ivy.

This change resolves a number of failing ivy tests, but also exposes other failures that were
masked by this issue. The tests have been updated accordingly.

(FW-812)

PR Close #27660
2018-12-17 14:51:34 -08:00
..
common fix(upgrade): improve downgrading-related error messages (#26217) 2018-11-05 16:33:55 -08:00
dynamic fix(upgrade): upgrade Directive facade should not return different instance from constructor (#27660) 2018-12-17 14:51:34 -08:00
static fix(upgrade): improve downgrading-related error messages (#26217) 2018-11-05 16:33:55 -08:00