@@ -3,17 +3,17 @@ import {
3
3
ReflectiveInjector , ResolvedReflectiveProvider , ViewContainerRef ,
4
4
Inject , ComponentFactoryResolver , Injector
5
5
} from '@angular/core' ;
6
- import { isPresent } from "../lang-facade" ;
7
- import { RouterOutletMap , ActivatedRoute , PRIMARY_OUTLET } from '@angular/router' ;
8
- import { NSLocationStrategy } from "./ns-location-strategy" ;
9
- import { DEVICE } from "../platform-providers" ;
10
- import { Device } from "platform" ;
11
- import { routerLog } from "../trace" ;
12
- import { DetachedLoader } from "../common/detached-loader" ;
13
- import { ViewUtil } from "../view-util" ;
14
- import { Frame } from "ui/frame" ;
15
- import { Page , NavigatedData } from "ui/page" ;
16
- import { BehaviorSubject } from "rxjs" ;
6
+ import { isPresent } from "../lang-facade" ;
7
+ import { RouterOutletMap , ActivatedRoute , PRIMARY_OUTLET } from '@angular/router' ;
8
+ import { NSLocationStrategy } from "./ns-location-strategy" ;
9
+ import { DEVICE , PAGE_FACTORY , PageFactory } from "../platform-providers" ;
10
+ import { Device } from "platform" ;
11
+ import { routerLog } from "../trace" ;
12
+ import { DetachedLoader } from "../common/detached-loader" ;
13
+ import { ViewUtil } from "../view-util" ;
14
+ import { Frame } from "ui/frame" ;
15
+ import { Page , NavigatedData } from "ui/page" ;
16
+ import { BehaviorSubject } from "rxjs" ;
17
17
18
18
interface CacheItem {
19
19
componentRef : ComponentRef < any > ;
@@ -95,7 +95,8 @@ export class PageRouterOutlet {
95
95
private componentFactoryResolver : ComponentFactoryResolver ,
96
96
resolver : ComponentFactoryResolver ,
97
97
private frame : Frame ,
98
- @Inject ( DEVICE ) device : Device ) {
98
+ @Inject ( DEVICE ) device : Device ,
99
+ @Inject ( PAGE_FACTORY ) private pageFactory : PageFactory ) {
99
100
100
101
parentOutletMap . registerOutlet ( name ? name : PRIMARY_OUTLET , < any > this ) ;
101
102
@@ -141,10 +142,10 @@ export class PageRouterOutlet {
141
142
* Called by the Router to instantiate a new component during the commit phase of a navigation.
142
143
* This method in turn is responsible for calling the `routerOnActivate` hook of its child.
143
144
*/
144
- activate (
145
- activatedRoute : ActivatedRoute , loadedResolver : ComponentFactoryResolver ,
146
- loadedInjector : Injector , providers : ResolvedReflectiveProvider [ ] ,
147
- outletMap : RouterOutletMap ) : void {
145
+ activate (
146
+ activatedRoute : ActivatedRoute , loadedResolver : ComponentFactoryResolver ,
147
+ loadedInjector : Injector , providers : ResolvedReflectiveProvider [ ] ,
148
+ outletMap : RouterOutletMap ) : void {
148
149
this . outletMap = outletMap ;
149
150
this . currentActivatedRoute = activatedRoute ;
150
151
@@ -174,9 +175,9 @@ export class PageRouterOutlet {
174
175
} else {
175
176
log ( "PageRouterOutlet.activate() forward navigation - create detached loader in the loader container" ) ;
176
177
177
- const page = new Page ( ) ;
178
+ const page = this . pageFactory ( { isNavigation : true , componentType : factory . componentType } ) ;
178
179
const pageResolvedProvider = ReflectiveInjector . resolve ( [
179
- { provide : Page , useValue : page }
180
+ { provide : Page , useValue : page }
180
181
] ) ;
181
182
const childInjector = ReflectiveInjector . fromResolvedProviders ( [ ...providers , ...pageResolvedProvider ] , this . containerRef . parentInjector ) ;
182
183
const loaderRef = this . containerRef . createComponent ( this . detachedLoaderFactory , this . containerRef . length , childInjector , [ ] ) ;
0 commit comments