页面加载完成事件(非刷新情况下,页面切换是不会重复触发此事件的,只在第一次进入页面时触发,需要重复触发的话请使用 $ionicView.enter 事件)

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://ionicframework.com/docs/api/directive/ionView/

关于$http和$ionicLoading对象,要在控制器使用ionic系统对象的时候,只需要在第二参数里加入变量,然后在最后的函数参数里也加入参数就可以了

ionic 页面加载事件及loading动画的更多相关文章

  1. 一个等待页面加载完毕的loading动画

    1 html 部分 <!DOCTYPE html><html><head><meta http-equiv="Content-Type" ...

  2. 从零开始学 Web 之 jQuery(一)jQuery的概念,页面加载事件

    大家好,这里是「 从零开始学 Web 系列教程 」,并在下列地址同步更新...... github:https://github.com/Daotin/Web 微信公众号:Web前端之巅 博客园:ht ...

  3. 页面加载时的div动画

    用@keyframes(动画),实现页面加载时的div动画(不要用js控制,因为当页面加载的时候,js还不一定可以使用) 可以在https://daneden.github.io/animate.cs ...

  4. Ionic页面加载前 ionic页面加载完成 ionic页面销毁执行的事件

    ionic 中$ionicView.beforeEnter(页面刚加载前)  $ionicView.afterEnter  (页面加载完成) $destroy(页面销毁) 广播事件 //ionic c ...

  5. JS实现页面加载完毕之前loading提示效果

    1.获取浏览器页面可见高度和宽度 var _PageHeight = document.documentElement.clientHeight, _PageWidth = document.docu ...

  6. jQuery 页面加载事件

    页面加载完成有两种事件,一是ready,表示文档结构已经加载完成(不包含图片等非文字媒体文件),二是onload,指示页 面包含图片等文件在内的所有元素都加载完成.(可以说:ready 在onload ...

  7. JavaScript 之 页面加载事件

    一.onload 加载事件 onload 是 window 对象的一个事件,也可以省略 window 直接使用. 常用方式: <head><script> windown.on ...

  8. js实现的页面加载完毕之前loading提示效果

    页面加载readyState的五种状态 原文如下: 0: (Uninitialized) the send( ) method has not yet been invoked. 1: (Loadin ...

  9. 所有DOM元素加载之前执行的页面加载事件[jquery]

    <script type="text/javascript"> (function() { alert("DOM还没加载"); })(jQuery) ...

随机推荐

  1. Shell执行将脚本里的变量打印到指定日志文件

    首先需要定位获取任务的运行日志或者报错信息,才能定位问题. 通过shell调用有些脚本的话,日志信息会打印在shell里.不过也有用户在shell里调用正常,但是到crontab调用的时候就出错并且没 ...

  2. 推荐2个干净的PE

    1,微PE(之前著名的通用PE.绝对PE都出自该作者) 官网:http://www.wepe.com.cn/ 2,金狐维护盘 官网:http://www.jinhu.me/

  3. iOS-打包成ipa的4种方法

    打包ipa的前提 1.证书的申请和设置和上面文章的一样 从第一步到第四步都是一样的http://www.cnblogs.com/sunfuyou/p/5900592.html2.还有第六步的 1-3都 ...

  4. 贪心算法or背包问题

    贪心方法:总是对当前的问题作最好的选择,也就是局部寻优.最后得到整体最优. 应用:1:该问题可以通过“局部寻优”逐步过渡到“整体最优”.贪心选择性质与“动态规划”的主要差别. 2:最优子结构性质:某个 ...

  5. 【C#】解析XML

    最近在尝试用WPF搞点桌面小应用. C#中使用System.Xml.XmlDocument类对XML文件进行操作. 文档详情如下: https://msdn.microsoft.com/en-us/l ...

  6. js本地图片预览,兼容ie[6-9]、火狐、Chrome17+、Opera11+、Maxthon3

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. Javascript 你不知道的事,好吧,是我不知道的事

    NaN表示一个不能产生正常结果的运算结果.它不等于任何值,包括它自己.可以用isNaN(number)来检测. 同Java中的字符串一样,JS中的字符串是不可变的.也就是说一旦字符串被创建,就无法改变 ...

  8. 探索Java语言与JVM中的Lambda表达式

    Lambda表达式是自Java SE 5引入泛型以来最重大的Java语言新特性,本文是2012年度最后一期Java Magazine中的一篇文章,它介绍了Lamdba的设计初衷,应用场景与基本语法.( ...

  9. 丰富您设计的10个CSS3效果库

    Magic CSS3 Animations Magic CSS3 Animations是一个CSS3动画包,拥有一些特效可以你的Web项目中免费使用.拥有像金光闪闪,角度,旋转,炸弹等特殊效果.使用简 ...

  10. 鼠标捕获(setCapture,releaseCapture)的学习

    鼠标捕获(setCapture)作用是将鼠标事件捕获到当前文档的指定的对象——对指定的对象设置鼠标捕获.这个对象会为当前应用程序或整个系统接收所有鼠标事件. 所谓鼠标捕获,是指对鼠标事件(onmous ...