11import {
2- Attribute ,
32 ChangeDetectorRef ,
43 ComponentFactory ,
54 ComponentFactoryResolver ,
@@ -9,14 +8,14 @@ import {
98 ElementRef ,
109 EnvironmentInjector ,
1110 EventEmitter ,
12- Inject ,
11+ HostAttributeToken ,
12+ inject ,
1313 InjectionToken ,
1414 InjectOptions ,
1515 Injector ,
1616 NgZone ,
1717 OnDestroy ,
1818 Output ,
19- SkipSelf ,
2019 Type ,
2120 ViewContainerRef ,
2221} from '@angular/core' ;
@@ -88,14 +87,8 @@ export class DestructibleInjector implements Injector {
8887 const ref = this . parent . get ( token , notFoundValue , flags ) ;
8988
9089 // if we're skipping ourselves then it's not our responsibility to destroy
91- if ( typeof flags === 'number' ) {
92- if ( ! ( flags && this . destructibleProviders . has ( token ) ) ) {
93- this . refs . add ( ref ) ;
94- }
95- } else {
96- if ( ! flags ?. skipSelf && this . destructibleProviders . has ( token ) ) {
97- this . refs . add ( ref ) ;
98- }
90+ if ( ! flags ?. skipSelf && this . destructibleProviders . has ( token ) ) {
91+ this . refs . add ( ref ) ;
9992 }
10093
10194 return ref ;
@@ -123,6 +116,17 @@ registerElement('page-router-outlet', () => Frame);
123116 standalone : true ,
124117} ) // tslint:disable-line:directive-selector
125118export class PageRouterOutlet implements OnDestroy , RouterOutletContract {
119+ private parentContexts = inject ( ChildrenOutletContexts ) ;
120+ private location = inject ( ViewContainerRef ) ;
121+ private locationStrategy = inject ( NSLocationStrategy ) ;
122+ private resolver = inject ( ComponentFactoryResolver ) ;
123+ private changeDetector = inject ( ChangeDetectorRef ) ;
124+ private pageFactory = inject < PageFactory > ( PAGE_FACTORY ) ;
125+ private routeReuseStrategy = inject ( NSRouteReuseStrategy ) ;
126+ private ngZone = inject ( NgZone ) ;
127+ private router = inject ( Router ) ;
128+ private environmentInjector = inject ( EnvironmentInjector ) ;
129+
126130 // tslint:disable-line:directive-class-suffix
127131 private activated : ComponentRef < any > | null = null ;
128132 private _activatedRoute : ActivatedRoute | null = null ;
@@ -146,15 +150,6 @@ export class PageRouterOutlet implements OnDestroy, RouterOutletContract {
146150 // eslint-disable-next-line @angular-eslint/no-output-rename
147151 @Output ( 'deactivate' ) deactivateEvents = new EventEmitter < any > ( ) ; // tslint:disable-line:no-output-rename
148152
149- /** @deprecated from Angular since v4 */
150- get locationInjector ( ) : Injector {
151- return this . location . injector ;
152- }
153- /** @deprecated from Angular since v4 */
154- get locationFactoryResolver ( ) : ComponentFactoryResolver {
155- return this . resolver ;
156- }
157-
158153 get isActivated ( ) : boolean {
159154 return ! ! this . activated ;
160155 }
@@ -187,24 +182,15 @@ export class PageRouterOutlet implements OnDestroy, RouterOutletContract {
187182 return { } ;
188183 }
189184
190- constructor (
191- private parentContexts : ChildrenOutletContexts ,
192- private location : ViewContainerRef ,
193- @Attribute ( 'name' ) name : string ,
194- @Attribute ( 'actionBarVisibility' ) actionBarVisibility : string ,
195- @Attribute ( 'isEmptyOutlet' ) isEmptyOutlet : boolean ,
196- private locationStrategy : NSLocationStrategy ,
197- private componentFactoryResolver : ComponentFactoryResolver ,
198- private resolver : ComponentFactoryResolver ,
199- private changeDetector : ChangeDetectorRef ,
200- @Inject ( PAGE_FACTORY ) private pageFactory : PageFactory ,
201- private routeReuseStrategy : NSRouteReuseStrategy ,
202- private ngZone : NgZone ,
203- private router : Router ,
204- elRef : ElementRef ,
205- viewUtil : ViewUtil ,
206- private environmentInjector : EnvironmentInjector ,
207- ) {
185+ constructor ( ) {
186+ const parentContexts = this . parentContexts ;
187+ const name = inject ( new HostAttributeToken ( 'name' ) , { optional : true } ) ;
188+ const actionBarVisibility = inject ( new HostAttributeToken ( 'actionBarVisibility' ) , { optional : true } ) ;
189+ const isEmptyOutlet = ! ! inject ( new HostAttributeToken ( 'isEmptyOutlet' ) , { optional : true } ) ;
190+ const resolver = this . resolver ;
191+ const elRef = inject ( ElementRef ) ;
192+ const viewUtil = inject ( ViewUtil ) ;
193+
208194 this . isEmptyOutlet = isEmptyOutlet ;
209195 this . frame = elRef . nativeElement ;
210196 this . setActionBarVisibility ( actionBarVisibility ) ;
0 commit comments