尝试从http请求上遏制缓存:

http://blog.csdn.net/u010039979/article/details/54376856

     if (!$httpProvider.defaults.headers.get) {
$httpProvider.defaults.headers.get = {};
}
//或者可以写成
$httpProvider.defaults.headers.get = $httpProvider.defaults.headers.get || {};
     $httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
$httpProvider.defaults.headers.common['X-Requested-with'] = 'XMLHttpRequest';
$httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache';
$httpProvider.defaults.headers.get['Pragma'] = 'no-cache';

想要适当缓存:http://www.cnblogs.com/jiuyuehe/p/5238622.html

(function () {

  'use strict';

  var AppController = function ($scope, $rootScope, TranslateService) {
// Set page title on each page
this.listener = $scope.$on('$routeChangeSuccess', function (e, nextRoute) {
if (nextRoute.$$route && angular.isDefined(nextRoute.$$route.pageTitle)) {
$scope.pageTitle = nextRoute.$$route.pageTitle + ' | Bosch Warranty Process';
}
}); // when account data changes, set language that needs to be used
this.watcher = $rootScope.$watch('account', function () {
if (typeof $rootScope.account != 'undefined' && typeof $rootScope.account.language != 'undefined') {
TranslateService.changeLanguage($rootScope.account.language);
} else {
TranslateService.setDefaultLanguage();
}
}); $scope.$on("$destroy",function(){
AppController.listener();
    AppController.listener = null;
    $scope.$destroy();
}); $rootScope.$on("$destroy",function(){
AppController.watcher();
    AppController.watcher = null;
    $rootScope.$destroy();
    $rootScope.$digest();
});
}; AppController.$inject = ['$scope', '$rootScope', 'TranslateService']; angular
.module('warrantyProcessApp')
.controller('AppController', AppController); })();

清除rooteScope:

-    it('should ignore remove on root', inject(function($rootScope) {
+ it('should broadcast $destroy on rootScope', inject(function($rootScope) {
+ var spy = spyOn(angular, 'noop');
+ $rootScope.$on('$destroy', angular.noop);
$rootScope.$destroy();
$rootScope.$digest();
expect(log).toEqual('');
+ expect(spy).toHaveBeenCalled();
+ expect($rootScope.$$destroyed).toBe(true);
}));

https://github.com/angular/angular.js/commit/d802ed1b3680cfc1751777fac465b92ee29944dc

关于$digest();

理解Angular中的$apply()以及$digest()

清除scope:

  var offDestroy = $scope.$on('$destroy', function() {
scope.$destroy();
});
scope.$on('$destroy', offDestroy);

清除scope监听的事件http://liyunpeng.iteye.com/blog/2257154

另外闭包什么的就麻烦了:

http://www.cnblogs.com/carekee/articles/1733847.html

语法错集锦:

Error: [$compile:ctreq] Controller 'ngModel', required by directive 'ngChange', can't be found!

提示:有ng-change的标签却没有ng-module

解决方法:在input上加上ng-model属性,例如你要获取input里面的值,在controller中定义: $scope.aValue = '', 然后模板中 <input ng-model='aValue' ng-change='mychange()' />

要胀爆的Angular1.0的更多相关文章

  1. webpack前端构建angular1.0!!!

    webpack前端构建angular1.0 Webpack最近很热,用webapcak构建react,vue,angular2.0的文章很多,但是webpack构建angualr1.0的文章找来找去也 ...

  2. angular1.0 app

    angular 1.0 简单的说一下就是ng启动阶段是 config-->run-->compile/link config阶段是给了ng上下文一个针对constant与provider修 ...

  3. UVa 10382 - Watering Grass 贪心,水题,爆int 难度: 0

    题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  4. Angular1.0

    公司会议室组织分享,两个小时困死我了,一点凌乱笔记: $http.get和promise一样有then方法,成功,失败 jquery each遍历对象i,n ng-app ng-controller ...

  5. Angular1.0 在Directive中调用Controller的方法

    Controller中定义了$scope.method = function(){} Directive中需要引入$scope http://stackoverflow.com/questions/2 ...

  6. Angular1.0路由的Hashbang和HTML5模式

    原文答主jupiter http://stackoverflow.com/questions/16677528/location-switching-between-html5-and-hashban ...

  7. angular1.0 $http jsonp callback

    $http.jsonp(sDUrl,{cache:false,jsonpCallbackParam:'callback'}); https://stackoverflow.com/questions/ ...

  8. angularjs 2.0 快速案例(1)

    前言 上一节我们已经把环境给搭建起来了,现在我们通过一个快速案例把angular 2.0 初步了解一下,后续我们会深入每一个细节,这个案例主要是一个[英雄(Hero)]列表的展示,创建,编辑.这个案例 ...

  9. Webstorm 下的Angular2.0开发之路

    人一旦上了年纪,记忆力就变得越来越不好. 最近写了许多的博文,倒不是为了给谁看,而是方便自己来搜索,不然一下子又忘记了. 如果恰巧帮助到了你,也是我的荣幸~~~~~~~~~~~~ 废话不多说,看正题~ ...

随机推荐

  1. Ubuntu 16.04服务器版查看IP、网关、DNS(非DHCP)

    查看IP ifconfig em1 Link encap:Ethernet HWaddr F0:1F:AF:D6:17:DD inet addr:115.238.54.116 Bcast:115.23 ...

  2. FIREDAC记录SQL日志

    FIREDAC记录SQL日志 跟踪SQL日志可以方便开发的时候的程序调试.SQL日志记录会耗费服务费资源,正式部署中间件的时候,建议关闭SQL日志记录. FIREDAC通过使用TFDMoniFlatF ...

  3. Git:fatal: The remote end hung up unexpectedly

    一.配置公共密钥 https://help.github.com/articles/generating-ssh-keys/ 二.设置缓冲值(push文件较大时导致错误) \.git\config [ ...

  4. httpd配置文件中重写函数Rewrite

    [RewriteCond%{HTTP_HOST}^(www\.)?xxx\.com$] 这是重写条件,前面%{HTTP_HOST}表示当前访问的网址,只是指前缀部分,格式是www.xxx.com不包括 ...

  5. 高效重构 C++ 代码

    引言 Martin Fowler的<重构:改善既有代码的设计>一书从2003年问世至今已有十几年时间了,按照计算机领域日新月异的变化速度,重构已经算是一门陈旧的技术了.但是陈旧并不代表不重 ...

  6. Python 面向对象三(转载)

    来源:Mr.Seven www.cnblogs.com/wupeiqi/p/4766801.html 四.类的特殊成员 上文介绍了Python的类成员以及成员修饰符,从而了解到类中有字段.方法和属性三 ...

  7. 机器学习入门之四:机器学习的方法--SVM(支持向量机)(转载)

    转自 飞鸟各投林 SVM(支持向量机) 支持向量机算法是诞生于统计学习界,同时在机器学习界大放光彩的经典算法. 支持向量机算法从某种意义上来说是逻辑回归算法的强化:通过给予逻辑回归算法更严格的优化条件 ...

  8. Java学习之泛型和异常

    泛型 1,设计原则或目的:只要代码在编译的时候没有错误,就不会抛异常.  2,泛型通配符  :类型通配符一般是使用 ? 代替具体的类型实参.注意了,此处是类型实参,而不是类型形参!相当于(父类作用)L ...

  9. EffectiveJava(10)覆盖equals是视情况覆盖toString

    覆盖equals是视情况覆盖toString 1.toString返回字符串 className@163b91 -calssName 类的名称 @ @ 163b91 散列码的无符号十六进制表示法 2. ...

  10. Angular 学习笔记——ng-Resource

    <!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta http-equiv="C ...