在phoengap ionic项目开发中,很多时候我们需要刷新controller里面的数据,或者我们想在controller销毁的时候执行一些东西,或者我们想在controller数据加载完成以后执行一些事件。这个时候就用到了我们说的 ionic中controller加载前 controller加载完成 controller销毁执行的广播事件 Ionic 中$ionicView.beforeEnter(页面刚加载) $ionicView.afterEnter (页面加载完成) $destroy(页面销毁) 广播事件 $scope.$on('$ionicView.beforeEnter', function() { // get user settings console.log('beforeEnter'); }); $scope.$on('$ionicView.afterEnter', function() { console.log('afterEnter'); }, false); $scope.$on('$destroy',function(){ console.log('$destroy'); $rootScope.hideTabs = ' '; }) |
Archiver|手机版|小黑屋| PhoneGap中文网 ( 京ICP备13027796号-1 )
GMT+8, 2025-1-14 00:27 , Processed in 0.028237 second(s), 23 queries .
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.