页面加载完成事件(非刷新情况下,页面切换是不会重复触发此事件的,只在第一次进入页面时触发,需要重复触发的话请使用 $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. js怎么让时间函数的秒数在页面上显示是变化的

    <input type="text" id="showtime" value="" /><script type=&quo ...

  2. Java代码编写的30条建议

    1) 类名首字母应该大写.字段.方法以及对象(句柄)的首字母应小写.对于所有标识符,其中包含的所有单词都应紧靠在一起,而且大写中间单词的首字母.例如: ThisIsAClassName thisIsM ...

  3. 纯CSS3实现漂亮的价格表样式代码

    分享一款纯CSS3实现漂亮的价格表样式代码是一款常见的主机商发布产品价格信息页.效果图如下: 在线预览   源码下载 实现的代码. html代码: <div id="main" ...

  4. war 宽度变窄

    1.打开开始菜单-运行-输入Regedit 打开注册表编辑器 展开 HKEY_CURRENT_USER 继续展开 Software继续展开 Blizzard Entertainment 在Warcra ...

  5. mybatis深入学习

    最近做的一个活可以让我深入学习一下现在比较流行的ORM框架:mybatis/ibatis的内部原理,SQL的拦截,解析,dataSource和JDBC中做一些额外的事情.如果有可能的话想造一个比较简单 ...

  6. MySQL基本命令和操作

    开启和关闭mysql服务 Windows下开启和关闭mysql服务 net start mysql # 开启mysql服务 net stop mysql # 关闭mysql服务 没有重启mysql服务 ...

  7. drupal7请求异常,执行时间过长的解决方法

    drupal7请求错误,执行时间过长的解决办法 根据你的系统或网络设置Drupal不能读取网页,造成功能缺失.可能是web服务器配置或PHP设置引起的,可用更新.获取更新源.使用OpenID登 录或使 ...

  8. [LintCode]判断一个字符串是否包含另一个字符串的所有字符

    问题描述: 比较两个字符串A和B,确定A中是否包含B中所有的字符.字符串A和B中的字符都是 大写字母. 样例 给出 A = "ABCD" B = "ACD",返 ...

  9. ssh加密公私钥

    SSH公钥登录原理 在平时工作中我们经常要远程登录服务器,这就要用到SSH协议: $ ssh user@host 主要有两种登录方式:第一种为密码口令登录,第二种为公钥登录 密码口令登录 通过密码进行 ...

  10. 配置QQ企业邮箱小结

    https://exmail.qq.com/login 1,注册管理员账号 2,添加域名 3.设置MX记录 记录类型选:MX记录 主机记录(RR):不填(非万网可以填写@) 记录值与MX优先级分别为: ...