11import { Component , ViewChild } from '@angular/core' ;
22import { Nav , Platform } from 'ionic-angular' ;
3- import { StatusBar , Splashscreen } from 'ionic-native' ;
3+ import { StatusBar , Splashscreen , Deeplinks } from 'ionic-native' ;
44
5- import { Page1 } from '../pages/page1/page1' ;
6- import { Page2 } from '../pages/page2/page2' ;
75import { TopicsPage } from '../pages/topics/topics' ;
6+ import { UserPage } from '../pages/user/user' ;
87
98
109@Component ( {
@@ -19,14 +18,6 @@ export class MyApp {
1918
2019 constructor ( public platform : Platform ) {
2120 this . initializeApp ( ) ;
22-
23- // used for an example of ngFor and navigation
24- this . pages = [
25- { title : 'Topics' , component : TopicsPage } ,
26- { title : 'Page One' , component : Page1 } ,
27- { title : 'Page Two' , component : Page2 }
28- ] ;
29-
3021 }
3122
3223 initializeApp ( ) {
@@ -43,4 +34,16 @@ export class MyApp {
4334 // we wouldn't want the back button to show in this scenario
4435 this . nav . setRoot ( page . component ) ;
4536 }
37+
38+ ngAfterViewInit ( ) {
39+ console . log ( 'ng after view init' )
40+ Deeplinks . routeWithNavController ( this . nav , {
41+ '/topics' : TopicsPage ,
42+ '/user/:loginname' : UserPage
43+ } ) . subscribe ( ( match ) => {
44+ console . log ( 'Successfully routed' , match ) ;
45+ } , ( nomatch ) => {
46+ console . warn ( 'Unmatched Route' , nomatch ) ;
47+ } ) ;
48+ }
4649}
0 commit comments