路由
1、不传参
1)非属性跳转:
constructor(public navCtrl: NavController) {
}
this.navCtrl.push(ArticlePage)
2)属性跳转
<button ion-button [navPush]="pushPage"></button>
2、传参
1)非属性跳转
this.navCtrl.push(ArticlePage , {
id: "123",
name: "Carl"
});
2)属性跳转
constructor(){
this.pushPage = LoginPage;
this.params = { id: 42 };
}
<button ion-button [navPush]="pushPage" [navParams]="params">Go</button>
3、获取传过来的参数
import { NavParams } from 'ionic-angular';
constructor(private navParams: NavParams) {
let id = this.navParams.get('id');
let name = this.navParams.get('name');
}