页面加载完成事件(非刷新情况下,页面切换是不会重复触发此事件的,只在第一次进入页面时触发,需要重复触发的话请使用 $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. java调用c库实例

    java由于语言限制,不能使用char*作为返回值. 局部变量的字符串不能正常返回,vc可以正常接收,java不能接收. c语言 int __stdcall GetCharacterCodeJn(ch ...

  2. JavaScript高级 面向对象(8)--浅拷贝代码实现

    说明(2017.3.31): 1. 浅拷贝,只有值属性,没有引用属性. 2. 在原对象里面添加一个copy方法,返回本对象内的所有值属性. <!DOCTYPE html> <html ...

  3. Lo4j(一)初识

    最近开始在研究log4j,可能因为是想要自己去搭建框架那. 废话不多说,先上一个例子好了. 第一步:当然是引入对象的jar包了 地址:http://www.apache.org/dyn/closer. ...

  4. idea中maven依赖不能下载的解决办法

    使用maven 命令 maven install 在项目所在文件夹 执行.

  5. 路径重写,适用于laravel,yii

    <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule& ...

  6. 百度分享vue版-vshare

    vshare 基于百度分享开发的支持VUE2.X的分享插件,为您带来更多的流量!提供多种风格按钮,代码加载更快,引入社会化流量,提升网页抓取速度等优点.github地址:https://github. ...

  7. [uart]理解线路规程的作用

    转自:http://biancheng.dnbcw.info/linux/336240.html Linux OS的设备驱动有相当经典的抽象思想以及分层思想.与通信世界里面的思想相一致. 一.在Lin ...

  8. c# dataTable 合并两个列到一个新列中

    public static DataTable UniteDataTableColumns(DataTable dt, String newColumnName, string ColumnName1 ...

  9. MVC教程二:从控制器中获取URL的值

    一.从控制器中获取URL的值有三种方式: 1.使用Request.QueryString[] 例如: string value = Request.QueryString["BookId&q ...

  10. s:debug标签的错误ConcurrentModificationException

    搭建SSH的时候页面上加入<s:debug>标签后台出现 严重: Servlet.service() for servlet jsp threw exception java.util.C ...