@@ -3,17 +3,17 @@ import {
33 ReflectiveInjector , ResolvedReflectiveProvider , ViewContainerRef ,
44 Inject , ComponentFactoryResolver , Injector
55} 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" ;
1717
1818interface CacheItem {
1919 componentRef : ComponentRef < any > ;
@@ -95,7 +95,8 @@ export class PageRouterOutlet {
9595 private componentFactoryResolver : ComponentFactoryResolver ,
9696 resolver : ComponentFactoryResolver ,
9797 private frame : Frame ,
98- @Inject ( DEVICE ) device : Device ) {
98+ @Inject ( DEVICE ) device : Device ,
99+ @Inject ( PAGE_FACTORY ) private pageFactory : PageFactory ) {
99100
100101 parentOutletMap . registerOutlet ( name ? name : PRIMARY_OUTLET , < any > this ) ;
101102
@@ -141,10 +142,10 @@ export class PageRouterOutlet {
141142 * Called by the Router to instantiate a new component during the commit phase of a navigation.
142143 * This method in turn is responsible for calling the `routerOnActivate` hook of its child.
143144 */
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 {
148149 this . outletMap = outletMap ;
149150 this . currentActivatedRoute = activatedRoute ;
150151
@@ -174,9 +175,9 @@ export class PageRouterOutlet {
174175 } else {
175176 log ( "PageRouterOutlet.activate() forward navigation - create detached loader in the loader container" ) ;
176177
177- const page = new Page ( ) ;
178+ const page = this . pageFactory ( { isNavigation : true , componentType : factory . componentType } ) ;
178179 const pageResolvedProvider = ReflectiveInjector . resolve ( [
179- { provide : Page , useValue : page }
180+ { provide : Page , useValue : page }
180181 ] ) ;
181182 const childInjector = ReflectiveInjector . fromResolvedProviders ( [ ...providers , ...pageResolvedProvider ] , this . containerRef . parentInjector ) ;
182183 const loaderRef = this . containerRef . createComponent ( this . detachedLoaderFactory , this . containerRef . length , childInjector , [ ] ) ;
0 commit comments