ionic 页面加载事件及loading动画
页面加载完成事件(非刷新情况下,页面切换是不会重复触发此事件的,只在第一次进入页面时触发,需要重复触发的话请使用 $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动画的更多相关文章
- 一个等待页面加载完毕的loading动画
1 html 部分 <!DOCTYPE html><html><head><meta http-equiv="Content-Type" ...
- 从零开始学 Web 之 jQuery(一)jQuery的概念,页面加载事件
大家好,这里是「 从零开始学 Web 系列教程 」,并在下列地址同步更新...... github:https://github.com/Daotin/Web 微信公众号:Web前端之巅 博客园:ht ...
- 页面加载时的div动画
用@keyframes(动画),实现页面加载时的div动画(不要用js控制,因为当页面加载的时候,js还不一定可以使用) 可以在https://daneden.github.io/animate.cs ...
- Ionic页面加载前 ionic页面加载完成 ionic页面销毁执行的事件
ionic 中$ionicView.beforeEnter(页面刚加载前) $ionicView.afterEnter (页面加载完成) $destroy(页面销毁) 广播事件 //ionic c ...
- JS实现页面加载完毕之前loading提示效果
1.获取浏览器页面可见高度和宽度 var _PageHeight = document.documentElement.clientHeight, _PageWidth = document.docu ...
- jQuery 页面加载事件
页面加载完成有两种事件,一是ready,表示文档结构已经加载完成(不包含图片等非文字媒体文件),二是onload,指示页 面包含图片等文件在内的所有元素都加载完成.(可以说:ready 在onload ...
- JavaScript 之 页面加载事件
一.onload 加载事件 onload 是 window 对象的一个事件,也可以省略 window 直接使用. 常用方式: <head><script> windown.on ...
- js实现的页面加载完毕之前loading提示效果
页面加载readyState的五种状态 原文如下: 0: (Uninitialized) the send( ) method has not yet been invoked. 1: (Loadin ...
- 所有DOM元素加载之前执行的页面加载事件[jquery]
<script type="text/javascript"> (function() { alert("DOM还没加载"); })(jQuery) ...
随机推荐
- 错误地使用catch
try { // do something } catch (Exception e) { } 错误:这里,catch了Exception,但是在catch中什么动作都没做,那么所有的Exceptio ...
- logback日志模板与详解
<pattern>的转换符说明: (这部分引用自http://aub.iteye.com/blog/1103685)转换符 作用 c {length } lo {length } logg ...
- jsp版ueditor图片在线管理返回绝对路径
引用:http://zhengyunfei.iteye.com/blog/2149979 如果你有富文本编辑器的功能需要开发,我推荐你用百度的ueditor.本文将与你分享jsp版ueditor开发中 ...
- 适配器模式和外观模式(head first设计模式——6)
为什么要把适配器模式和外观模式放在同一篇文章中,主要是其相对前面的几个模式来讲会简单些并且具有相似之处.下面就分别通过例子来看理解一下两种模式,然后再进行对其进行比较. 一.适配器模式 1.1适配器模 ...
- java日期工具类DateUtil
一名优秀的程序员,不仅需要有着丰富解决问题的方案,还需要的便是代码的沉淀,这不仅有助于自己快速的开发程序,也有利于保证程序的健壮.那如何才能沉淀自己的”代码“呢?从自己编写util开始其实就是一个不错 ...
- Ubuntu下安装Apache
Ubuntu为我们提供了 su apt-get install 命令,通过它你可以很方便地安装一些软件,这些软件是放在Ubuntu放置在各个地方的服务器上面,如果你想安装的软件是比较常见的,一般都可以 ...
- 去除idea15重复代码校验
- java-javaweb_URL重写
Java WEB实现URL重写的优缺点及如何实现: http://blog.csdn.net/cselmu9/article/details/8062033 urlrewrite 地址重写: http ...
- Python time & datetime & string 相互转换
#!/usr/bin/env python# -*- coding:utf-8 -*- # @Datetime : 2017/11/23 下午12:37# @Author : Alfred Xue# ...
- 基于Java的四大开源测试工具
摘要:成功的应用程序离不开测试人员和QA团队反复地测试,应用程序在进行最后的部署之前,需要通过测试来确保它的负载管理能力以及在特殊情况下的工作条件和工作加载情况. %R[)vA t]N0 测试是应用程 ...