2017-02-17 6 views
2

私はイオン2のフレームワークで非常に新しいです。私は知りたいです、私はどのようにURLを使用してイオンアプリでナビゲートすることができます。 Angular 2アプリケーションでは、ナビゲーションと同様の方法が使用されます。ログインボタン付き8100 /イントロし、ボタンを押した後、私はローカルホスト上ホームページにリダイレクトになりたい::8100 /家イオン2:URLを使ってナビゲート

のは、私がローカルホスト上のIntroPageを持たせたいとしましょう。ドキュメントが言うように

localhost:8100/intro -> localhost:8100/home 

答えて

2

あなたはionic2のDeepLinkerを使用することができます。

ionic2では、this.navigator.push(SomeComponent)で移動できます。しかし、あなたがURLを変更したい場合は、次のようなディープリンクを定義する必要があります。

imports: [ 
IonicModule.forRoot(MyApp, {}, { 
    links: [ 
    { component: HomePage, name: 'Home', segment: 'home' } 
    ] 
}) 
] 
0

は:あなたはまだUI-SREFイオン1..butのみthis.navigation.push(「ホーム」)のように使用することはできません(https://ionicframework.com/docs/v2/api/navigation/NavController/) ...それはあなたがしなければならないことTSファイルのナビゲーションを呼び出すためのHTML(多分(クリック)= "myfunc関数()")上の機能

import { Component, ViewChild } from '@angular/core'; 
import { NavController } from 'ionic-angular'; 

@Component({ 
    template: '<ion-nav #myNav [root]="rootPage"></ion-nav>' 
}) 
export class MyApp { 
    @ViewChild('myNav') nav: NavController 
    public rootPage = TabsPage; 

    // Wait for the components in MyApp's template to be initialized 
    // In this case, we are waiting for the Nav with reference variable of "#myNav" 
    ngOnInit() { 
     // Let's navigate from TabsPage to Page1 
     this.nav.push('home'); 
    } 
}