您的位置:首页
ionic 页面加载事件及loading动画
2016-11-10 14:10
441 查看
页面加载完成事件(非刷新情况下,页面切换是不会重复触发此事件的,只在第一次进入页面时触发,需要重复触发的话请使用 $ionicView.enter 事件)
其他事件如下:
官方文档:http://ionicframework.com/docs/api/directive/ionView/
关于$http和$ionicLoading对象,要在控制器使用ionic系统对象的时候,只需要在第二参数里加入变量,然后在最后的函数参数里也加入参数就可以了
angular.module('app.controllers', []) .controller('page6Ctrl', ['$scope', '$http', '$stateParams', '$ionicLoading', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller // You can include any angular dependencies as parameters for this function // TIP: Access Route Parameters for your page via $stateParams.parameterName function($scope, $http, $stateParams, $ionicLoading) { $scope.$on('$ionicView.loaded', function(event, data) { $ionicLoading.show(); $http.get("js/123.json") .success(function(res) { $ionicLoading.hide(); }); }); } ])
其他事件如下:
$ionicView.loaded | The view has loaded. This event only happens once per view being created and added to the DOM. If a view leaves but is cached, then this event will not fire again on a subsequent viewing. The loaded event is good place to put your setup code for the view; however, it is not the recommended event to listen to when a view becomes active. |
$ionicView.enter | The view has fully entered and is now the active view. This event will fire, whether it was the first load or a cached view. |
$ionicView.leave | The view has finished leaving and is no longer the active view. This event will fire, whether it is cached or destroyed. |
$ionicView.beforeEnter | The view is about to enter and become the active view. |
$ionicView.beforeLeave | The view is about to leave and no longer be the active view. |
$ionicView.afterEnter | The view has fully entered and is now the active view. |
$ionicView.afterLeave | The view has finished leaving and is no longer the active view. |
$ionicView.unloaded | The view's controller has been destroyed and its element has been removed from the DOM. |
$ionicParentView.enter | The parent view has fully entered and is now the active view. This event will fire, whether it was the first load or a cached view. |
$ionicParentView.leave | The parent view has finished leaving and is no longer the active view. This event will fire, whether it is cached or destroyed. |
$ionicParentView.beforeEnter | The parent view is about to enter and become the active view. |
$ionicParentView.beforeLeave | The parent view is about to leave and no longer be the active view. |
$ionicParentView.afterEnter | The parent view has fully entered and is now the active view. |
$ionicParentView.afterLeave | The parent view has finished leaving and is no longer the active view. |
关于$http和$ionicLoading对象,要在控制器使用ionic系统对象的时候,只需要在第二参数里加入变量,然后在最后的函数参数里也加入参数就可以了
相关文章推荐
- 30种CSS3炫酷页面预加载loading动画特效
- load-awesome 53种纯CSS3预加载页面loading指示器动画特效
- 【Ionic】---$ionicLoading ion-spinner SVG旋转加载的动画图标
- 页面预加载loading动画,再载入内容
- 页面预加载loading动画,再载入内容
- jquery实现进度条无百分比动画loading页面加载特效
- ionic 加载动作$ionicLoading 和加载动画 ion-spinner
- Ionic页面加载前 ionic页面加载完成 ionic页面销毁执行的事件
- jQuery 中的 Ajax 全局事件 当用户点击页面上某一按钮请求数据时,在页面上显示 loading... ,页面加载完成后隐藏
- ionic之$ionicLoading实现加载动画
- ionic笔记——$ionicLoading加载及加载动画的变更
- 基于javascript实现页面加载loading动画
- 升级到ionic3 Lazy Loading懒加载,ionic3新建页面
- Ionic页面加载前 ionic页面加载完成 ionic页面销毁执行的事件
- Ionic页面加载前 ionic页面加载完成 ionic页面销毁执行的事件
- 页面预加载loading动画,再载入内容
- 一个等待页面加载完毕的loading动画
- 页面加载时显示一个loading的图片或者动画或者提示信息
- HTML页面加载和请求发送时LOADING动画
- asp.net页面事件加载顺序