@@ -45,7 +45,7 @@ export const createConnect = <A extends Overmind<any>>(overmind: A) => () => {
4545 }
4646
4747 if ( targetNgOnInit ) {
48- targetNgOnInit . apply ( target )
48+ targetNgOnInit . call ( this )
4949 }
5050
5151 if (
@@ -63,7 +63,7 @@ export const createConnect = <A extends Overmind<any>>(overmind: A) => () => {
6363 this . __tree . track ( this . __onUpdate )
6464
6565 if ( targetNgAfterContentInit ) {
66- targetNgAfterContentInit . apply ( target )
66+ targetNgAfterContentInit . call ( this )
6767 }
6868 }
6969
@@ -76,7 +76,7 @@ export const createConnect = <A extends Overmind<any>>(overmind: A) => () => {
7676 } )
7777
7878 if ( targetNgAfterViewInit ) {
79- targetNgAfterViewInit . apply ( target )
79+ targetNgAfterViewInit . call ( this )
8080 }
8181 }
8282
@@ -85,7 +85,7 @@ export const createConnect = <A extends Overmind<any>>(overmind: A) => () => {
8585 this . __tree . track ( this . __onUpdate )
8686 }
8787 if ( targetNgDoCheck ) {
88- targetNgDoCheck . apply ( target )
88+ targetNgDoCheck . call ( this )
8989 }
9090 }
9191
@@ -101,23 +101,24 @@ export const createConnect = <A extends Overmind<any>>(overmind: A) => () => {
101101 } )
102102 }
103103 if ( targetNgAfterViewChecked ) {
104- targetNgAfterViewChecked . apply ( target )
104+ targetNgAfterViewChecked . call ( this )
105105 }
106106 }
107107
108108 let targetNgOnDestroy = target . prototype . ngOnDestroy
109109
110110 target . prototype . ngOnDestroy = function ( ) {
111- if ( targetNgOnDestroy ) {
112- targetNgOnDestroy . apply ( target )
113- }
114111 overmind . eventHub . emitAsync ( EventType . COMPONENT_REMOVE , {
115112 componentId,
116113 componentInstanceId : this . __componentInstanceId ,
117114 name : this . constructor . name || '' ,
118115 } )
119116 const anyOvermind = overmind as any
120117 anyOvermind . proxyStateTree . disposeTree ( this . __tree )
118+
119+ if ( targetNgOnDestroy ) {
120+ targetNgOnDestroy . call ( this )
121+ }
121122 }
122123
123124 return target
0 commit comments