进入页面是调用 $scope.$on('$ionicView.enter', function(){ //调用初始化的函数 $scope.onPullDown();}); 路由改变
路由发生改变的时候调用 $rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) { console.log("路由发生改变");}); ionic2 返回上一页 刷新列表
Events 有三个方法 分别是:
this.events.publish () //注册Events事件
this.events.subscribe() //调用Eevents事件
this.events.unsubscribe() //注销Events事件
列表页面
//返回上一页 页面刷新 this.events.subscribe("reloadBQHPage", () => { 调用Eevents事件 this.doRefresh(""); }); /** * 注:界面每次调用Push是会就是触发ionViewDidLoad事件,调用Pop的时候则会销毁界面,调用ionViewWillUnload。 * 所以注册Events事件的时候必须在界面销毁的时候把事件进行注销,不然下次调用则会重复执行Events中的注册的方法。 */ ionViewWillUnload() { console.log('界面销毁'); this.events.unsubscribe('ManagementSerachPage');注销Events事件 }表单提交页面
//页面返回//返回上一页 页面刷新 this.navCtrl.popTo("BehaviorWarning").then(() => { this.events.publish("reloadBQHPage");//注册Events事件 });