版本:Angular 1.5.3、Ionic1.3.2

一 禁用缓存,全页面刷新。

每次前进/ 后退时,控制器都会执行。

1 AngularJS ui-router路由禁用缓存

var app = angular.module('myApp',['ionic']);
app.config(function($stateProvider,$urlRouterProvider){
$stateProvider
.state('index',{
url:'/index',
cache : false,
templateUrl:'template/index.html',
controller:'indexCtrl'
})
$urlRouterProvider.otherwise('/index');
});

2 Ionic view禁用缓存

<ion-view title="index" cache-view="false">
<ion-content>
...
</ion-content>
</ion-view>

3 Ionic 全局禁用缓存

var app = angular.module('myApp',['ionic']);
app.config(function($stateProvider,$urlRouterProvider,$ionicConfigProvider){
$ionicConfigProvider.views.maxCache(0);
});

二 局部刷新

前进到页面,控制器执行;后退到页面,控制器不执行。

(function(angular){
angular.module('myApp')
.controller('indexCtrl',function($scope){
$scope.$on('$ionicView.beforeEnter',function(event,view){
$scope.refreshData(); // 自定义刷新方法
});
});
})(angular);

Ionic后退刷新的更多相关文章

  1. pushState、replaceState、onpopstate 实现Ajax页面的前进后退刷新

    使用Ajax可以异步获取数据,可以更高效地渲染页面. 但也存在这一些问题: 再刷新页面,页面就会变成初始的状态 浏览器的前进后退功能无效 对搜索引擎的爬虫抓取不友好 1. 早前会使用浏览器的 hash ...

  2. 通过history解决ajax不支持前进/后退/刷新

    前言: 现在前后端基本都是通过ajax实现前后端接口数据的交互,但是,ajax有个小小的劣势,即:不支持浏览器“后退”和“前进“键. 但是,现在我们可以通过H5的histroy属性 解决ajax在交互 ...

  3. ionic局部刷新页面与刷新整个页面

    1.全局刷新,禁用缓存: 在app.js中设置cach:false,如下: .state('material', { url: '/material', cache:false, templateUr ...

  4. ionic 局部刷新

    $scope.$on('$ionicView.beforeEnter', console.log("刷新"); })

  5. javascript中的后退和刷新

    <input type=button value=刷新 onclick="window.location.reload()"><input type=button ...

  6. javascript前进、后退、刷新的实现

    go(-1): 返回上一页, 原页面表单中的内容会丢失; back(-1): 返回上一页, 原页表表单中的内容会保留. <input type=button value=刷新 onclick=& ...

  7. 监控页面后退前进,浏览器文档加载事件之pageshow、pagehide

    https://www.cnblogs.com/milo-wjh/p/6811868.html http://www.runoob.com/jsref/event-onpageshow.html on ...

  8. PHP和JS页面跳转和刷新总结

    PHP 页面跳转: // 只是跳转,所以一定要用die();或者exit;终止下一步操作; header('location:index.php'); exit; // 等待3秒,跳转并刷新 head ...

  9. 关于ionic开发中遇到的坑与总结

    这次是第二次使用ionic开发混合app,今天算是对这个框架做一个总结,基础的我就不再重复了,网上都有教程.我就说说自己的心得和遇见的各种坑, 之后会陆续补充,想到什么说什么吧. 1.关于ionic效 ...

随机推荐

  1. python 阿狸的进阶之路(7)

    面向对象 转自林海峰的博客  http://www.cnblogs.com/linhaifeng/articles/6182264.html 面向对象的理解: 将数据分类,比如学生类.数据有关的函数, ...

  2. golang使用Nsq(转)

    为什么要使用Nsq 最近一直在寻找一个高性能,高可用的消息队列做内部服务之间的通讯.一开始想到用zeromq,但在查找资料的过程中,意外的发现了Nsq这个由golang开发的消息队列,毕竟是golan ...

  3. linux 2.6.32文件系统的dentry父子关系

    我们知道,linux文件系统,inode和dentry是有对应关系的,dentry是文件名或者目录的一个管理结构,2.6内核中: struct dentry { atomic_t d_count; u ...

  4. English Conversation – Checking in at an airport

    English Conversation – Checking in at an airport Share Tweet Share Tagged With: Ben Franklin Exercis ...

  5. Angular2学习笔记

    Angular2 这里 Angular2 是指采用 TypeScript 语言的 Angular 2.0及以上版本.与采用 JavaScript 语言的 AngularJS 相比,Angular2 不 ...

  6. JS 打印图片

    在使用window.print()进行打印时,打印的内容可能会包含图片内容,此时的图片内容不能设置为背景图片,否则将无法再打印页面显示. <!doctype html> <html& ...

  7. 自定义标签在IE6-8的困境

    或许未来前端组件化之路都是自定义标签,但这东西早在20年前,JSTL已在搞了.现在Web Component还只有webkit支持.但一个组件库,还需要一个特殊的标识它们是一块的.不过这个XML已经帮 ...

  8. 基于ajax请求异常捕获

    第一步:controller中 @RequestMapping("/ajaxerror") public String ajaxerror() { return "thy ...

  9. eclipse maven项目 热部署

    热部署:本地项目一键发布到远程服务器中 热部署步骤: 1. 在tomat/conf/tomcat-users.xml添加 <role rolename="manager-gui&quo ...

  10. spring boot 中使用filter