angular-rails-engine 1.2.3.0 → 1.2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/app/assets/javascripts/angular/angular-animate.js +56 -27
- data/app/assets/javascripts/angular/angular-animate.min.js +18 -18
- data/app/assets/javascripts/angular/angular-cookies.js +1 -1
- data/app/assets/javascripts/angular/angular-cookies.min.js +1 -2
- data/app/assets/javascripts/angular/angular-loader.js +2 -2
- data/app/assets/javascripts/angular/angular-loader.min.js +2 -3
- data/app/assets/javascripts/angular/angular-mocks.js +4 -3
- data/app/assets/javascripts/angular/angular-resource.js +23 -4
- data/app/assets/javascripts/angular/angular-resource.min.js +8 -8
- data/app/assets/javascripts/angular/angular-route.js +52 -32
- data/app/assets/javascripts/angular/angular-route.min.js +9 -10
- data/app/assets/javascripts/angular/angular-sanitize.js +18 -11
- data/app/assets/javascripts/angular/angular-sanitize.min.js +9 -10
- data/app/assets/javascripts/angular/angular-scenario.js +302 -215
- data/app/assets/javascripts/angular/angular-touch.js +1 -1
- data/app/assets/javascripts/angular/angular-touch.min.js +1 -2
- data/app/assets/javascripts/angular/angular.js +302 -215
- data/app/assets/javascripts/angular/angular.min.js +196 -197
- data/lib/angular-rails-engine.rb +1 -1
- data/lib/angular-rails-engine/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.5
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -57,13 +57,13 @@ function $RouteProvider(){
|
|
57
57
|
* `$location.path` will be updated to add or drop the trailing slash to exactly match the
|
58
58
|
* route definition.
|
59
59
|
*
|
60
|
-
* * `path` can contain named groups starting with a colon
|
60
|
+
* * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up
|
61
61
|
* to the next slash are matched and stored in `$routeParams` under the given `name`
|
62
62
|
* when the route matches.
|
63
|
-
* * `path` can contain named groups starting with a colon and ending with a star
|
64
|
-
* All characters are eagerly stored in `$routeParams` under the given `name`
|
63
|
+
* * `path` can contain named groups starting with a colon and ending with a star:
|
64
|
+
* e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name`
|
65
65
|
* when the route matches.
|
66
|
-
* * `path` can contain optional named groups with a question mark
|
66
|
+
* * `path` can contain optional named groups with a question mark: e.g.`:name?`.
|
67
67
|
*
|
68
68
|
* For example, routes like `/color/:color/largecode/:largecode*\/edit` will match
|
69
69
|
* `/color/brown/largecode/code/with/slashs/edit` and extract:
|
@@ -644,6 +644,8 @@ function $RouteParamsProvider() {
|
|
644
644
|
}
|
645
645
|
|
646
646
|
ngRouteModule.directive('ngView', ngViewFactory);
|
647
|
+
ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
648
|
+
|
647
649
|
|
648
650
|
/**
|
649
651
|
* @ngdoc directive
|
@@ -809,8 +811,8 @@ ngRouteModule.directive('ngView', ngViewFactory);
|
|
809
811
|
* @description
|
810
812
|
* Emitted every time the ngView content is reloaded.
|
811
813
|
*/
|
812
|
-
ngViewFactory.$inject = ['$route', '$anchorScroll', '$
|
813
|
-
function ngViewFactory( $route, $anchorScroll, $
|
814
|
+
ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];
|
815
|
+
function ngViewFactory( $route, $anchorScroll, $animate) {
|
814
816
|
return {
|
815
817
|
restrict: 'ECA',
|
816
818
|
terminal: true,
|
@@ -842,6 +844,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
|
|
842
844
|
|
843
845
|
if (template) {
|
844
846
|
var newScope = scope.$new();
|
847
|
+
var current = $route.current;
|
845
848
|
|
846
849
|
// Note: This will also link all children of ng-view that were contained in the original
|
847
850
|
// html. If that content contains controllers, ... they could pollute/change the scope.
|
@@ -849,34 +852,18 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
|
|
849
852
|
// Note: We can't remove them in the cloneAttchFn of $transclude as that
|
850
853
|
// function is called before linking the content, which would apply child
|
851
854
|
// directives to non existing elements.
|
852
|
-
var clone = $transclude(newScope,
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
}
|
855
|
+
var clone = $transclude(newScope, function(clone) {
|
856
|
+
$animate.enter(clone, null, currentElement || $element, function onNgViewEnter () {
|
857
|
+
if (angular.isDefined(autoScrollExp)
|
858
|
+
&& (!autoScrollExp || scope.$eval(autoScrollExp))) {
|
859
|
+
$anchorScroll();
|
860
|
+
}
|
861
|
+
});
|
862
|
+
cleanupLastView();
|
859
863
|
});
|
860
864
|
|
861
|
-
cleanupLastView();
|
862
|
-
|
863
|
-
var link = $compile(clone.contents()),
|
864
|
-
current = $route.current;
|
865
|
-
|
866
|
-
currentScope = current.scope = newScope;
|
867
865
|
currentElement = clone;
|
868
|
-
|
869
|
-
if (current.controller) {
|
870
|
-
locals.$scope = currentScope;
|
871
|
-
var controller = $controller(current.controller, locals);
|
872
|
-
if (current.controllerAs) {
|
873
|
-
currentScope[current.controllerAs] = controller;
|
874
|
-
}
|
875
|
-
clone.data('$ngControllerController', controller);
|
876
|
-
clone.children().data('$ngControllerController', controller);
|
877
|
-
}
|
878
|
-
|
879
|
-
link(currentScope);
|
866
|
+
currentScope = current.scope = newScope;
|
880
867
|
currentScope.$emit('$viewContentLoaded');
|
881
868
|
currentScope.$eval(onloadExp);
|
882
869
|
} else {
|
@@ -887,5 +874,38 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
|
|
887
874
|
};
|
888
875
|
}
|
889
876
|
|
877
|
+
// This directive is called during the $transclude call of the first `ngView` directive.
|
878
|
+
// It will replace and compile the content of the element with the loaded template.
|
879
|
+
// We need this directive so that the element content is already filled when
|
880
|
+
// the link function of another directive on the same element as ngView
|
881
|
+
// is called.
|
882
|
+
ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route'];
|
883
|
+
function ngViewFillContentFactory($compile, $controller, $route) {
|
884
|
+
return {
|
885
|
+
restrict: 'ECA',
|
886
|
+
priority: -400,
|
887
|
+
link: function(scope, $element) {
|
888
|
+
var current = $route.current,
|
889
|
+
locals = current.locals;
|
890
|
+
|
891
|
+
$element.html(locals.$template);
|
892
|
+
|
893
|
+
var link = $compile($element.contents());
|
894
|
+
|
895
|
+
if (current.controller) {
|
896
|
+
locals.$scope = scope;
|
897
|
+
var controller = $controller(current.controller, locals);
|
898
|
+
if (current.controllerAs) {
|
899
|
+
scope[current.controllerAs] = controller;
|
900
|
+
}
|
901
|
+
$element.data('$ngControllerController', controller);
|
902
|
+
$element.children().data('$ngControllerController', controller);
|
903
|
+
}
|
904
|
+
|
905
|
+
link(scope);
|
906
|
+
}
|
907
|
+
};
|
908
|
+
}
|
909
|
+
|
890
910
|
|
891
911
|
})(window, window.angular);
|
@@ -1,14 +1,13 @@
|
|
1
1
|
/*
|
2
|
-
AngularJS v1.2.
|
2
|
+
AngularJS v1.2.5
|
3
3
|
(c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
License: MIT
|
5
5
|
*/
|
6
|
-
(function(
|
7
|
-
(
|
8
|
-
function(b,c
|
9
|
-
["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache","$sce",function(
|
10
|
-
|
11
|
-
d,
|
12
|
-
|
13
|
-
window.angular);
|
14
|
-
//# sourceMappingURL=angular-route.min.js.map
|
6
|
+
(function(h,e,A){'use strict';function u(w,q,k){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,c,b,f,n){function y(){l&&(l.$destroy(),l=null);g&&(k.leave(g),g=null)}function v(){var b=w.current&&w.current.locals;if(b&&b.$template){var b=a.$new(),f=w.current;g=n(b,function(d){k.enter(d,null,g||c,function(){!e.isDefined(t)||t&&!a.$eval(t)||q()});y()});l=f.scope=b;l.$emit("$viewContentLoaded");l.$eval(h)}else y()}var l,g,t=b.autoscroll,h=b.onload||"";a.$on("$routeChangeSuccess",
|
7
|
+
v);v()}}}function z(e,h,k){return{restrict:"ECA",priority:-400,link:function(a,c){var b=k.current,f=b.locals;c.html(f.$template);var n=e(c.contents());b.controller&&(f.$scope=a,f=h(b.controller,f),b.controllerAs&&(a[b.controllerAs]=f),c.data("$ngControllerController",f),c.children().data("$ngControllerController",f));n(a)}}}h=e.module("ngRoute",["ng"]).provider("$route",function(){function h(a,c){return e.extend(new (e.extend(function(){},{prototype:a})),c)}function q(a,e){var b=e.caseInsensitiveMatch,
|
8
|
+
f={originalPath:a,regexp:a},h=f.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?|\*])?/g,function(a,e,b,c){a="?"===c?c:null;c="*"===c?c:null;h.push({name:b,optional:!!a});e=e||"";return""+(a?"":e)+"(?:"+(a?e:"")+(c&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");f.regexp=RegExp("^"+a+"$",b?"i":"");return f}var k={};this.when=function(a,c){k[a]=e.extend({reloadOnSearch:!0},c,a&&q(a,c));if(a){var b="/"==a[a.length-1]?a.substr(0,a.length-1):a+"/";k[b]=e.extend({redirectTo:a},
|
9
|
+
q(b,c))}return this};this.otherwise=function(a){this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache","$sce",function(a,c,b,f,n,q,v,l){function g(){var d=t(),m=r.current;if(d&&m&&d.$$route===m.$$route&&e.equals(d.pathParams,m.pathParams)&&!d.reloadOnSearch&&!x)m.params=d.params,e.copy(m.params,b),a.$broadcast("$routeUpdate",m);else if(d||m)x=!1,a.$broadcast("$routeChangeStart",d,m),(r.current=d)&&d.redirectTo&&(e.isString(d.redirectTo)?
|
10
|
+
c.path(u(d.redirectTo,d.params)).search(d.params).replace():c.url(d.redirectTo(d.pathParams,c.path(),c.search())).replace()),f.when(d).then(function(){if(d){var a=e.extend({},d.resolve),c,b;e.forEach(a,function(d,c){a[c]=e.isString(d)?n.get(d):n.invoke(d)});e.isDefined(c=d.template)?e.isFunction(c)&&(c=c(d.params)):e.isDefined(b=d.templateUrl)&&(e.isFunction(b)&&(b=b(d.params)),b=l.getTrustedResourceUrl(b),e.isDefined(b)&&(d.loadedTemplateUrl=b,c=q.get(b,{cache:v}).then(function(a){return a.data})));
|
11
|
+
e.isDefined(c)&&(a.$template=c);return f.all(a)}}).then(function(c){d==r.current&&(d&&(d.locals=c,e.copy(d.params,b)),a.$broadcast("$routeChangeSuccess",d,m))},function(c){d==r.current&&a.$broadcast("$routeChangeError",d,m,c)})}function t(){var a,b;e.forEach(k,function(f,k){var p;if(p=!b){var s=c.path();p=f.keys;var l={};if(f.regexp)if(s=f.regexp.exec(s)){for(var g=1,q=s.length;g<q;++g){var n=p[g-1],r="string"==typeof s[g]?decodeURIComponent(s[g]):s[g];n&&r&&(l[n.name]=r)}p=l}else p=null;else p=null;
|
12
|
+
p=a=p}p&&(b=h(f,{params:e.extend({},c.search(),a),pathParams:a}),b.$$route=f)});return b||k[null]&&h(k[null],{params:{},pathParams:{}})}function u(a,c){var b=[];e.forEach((a||"").split(":"),function(a,d){if(0===d)b.push(a);else{var e=a.match(/(\w+)(.*)/),f=e[1];b.push(c[f]);b.push(e[2]||"");delete c[f]}});return b.join("")}var x=!1,r={routes:k,reload:function(){x=!0;a.$evalAsync(g)}};a.$on("$locationChangeSuccess",g);return r}]});h.provider("$routeParams",function(){this.$get=function(){return{}}});
|
13
|
+
h.directive("ngView",u);h.directive("ngView",z);u.$inject=["$route","$anchorScroll","$animate"];z.$inject=["$compile","$controller","$route"]})(window,window.angular);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.5
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -365,25 +365,32 @@ function htmlParser( html, handler ) {
|
|
365
365
|
}
|
366
366
|
}
|
367
367
|
|
368
|
+
var hiddenPre=document.createElement("pre");
|
369
|
+
var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/;
|
368
370
|
/**
|
369
371
|
* decodes all entities into regular string
|
370
372
|
* @param value
|
371
373
|
* @returns {string} A string with decoded entities.
|
372
374
|
*/
|
373
|
-
var hiddenPre=document.createElement("pre");
|
374
375
|
function decodeEntities(value) {
|
375
|
-
if (!value) {
|
376
|
-
|
377
|
-
}
|
376
|
+
if (!value) { return ''; }
|
377
|
+
|
378
378
|
// Note: IE8 does not preserve spaces at the start/end of innerHTML
|
379
|
-
|
379
|
+
// so we must capture them and reattach them afterward
|
380
380
|
var parts = spaceRe.exec(value);
|
381
|
-
parts[
|
382
|
-
|
383
|
-
|
384
|
-
|
381
|
+
var spaceBefore = parts[1];
|
382
|
+
var spaceAfter = parts[3];
|
383
|
+
var content = parts[2];
|
384
|
+
if (content) {
|
385
|
+
hiddenPre.innerHTML=content.replace(/</g,"<");
|
386
|
+
// innerText depends on styling as it doesn't display hidden elements.
|
387
|
+
// Therefore, it's better to use textContent not to cause unnecessary
|
388
|
+
// reflows. However, IE<9 don't support textContent so the innerText
|
389
|
+
// fallback is necessary.
|
390
|
+
content = 'textContent' in hiddenPre ?
|
391
|
+
hiddenPre.textContent : hiddenPre.innerText;
|
385
392
|
}
|
386
|
-
return
|
393
|
+
return spaceBefore + content + spaceAfter;
|
387
394
|
}
|
388
395
|
|
389
396
|
/**
|
@@ -1,14 +1,13 @@
|
|
1
1
|
/*
|
2
|
-
AngularJS v1.2.
|
2
|
+
AngularJS v1.2.5
|
3
3
|
(c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
License: MIT
|
5
5
|
*/
|
6
|
-
(function(
|
7
|
-
if(0<=c){for(d=f.length-1;d>=c;d--)e.end&&e.end(f[d]);f.length=c}}var b,g,f=[],l=a;for(f.last=function(){return f[f.length-1]};a;){g=!0;if(f.last()&&
|
8
|
-
a.replace(b[0],""),g=!1}else if(
|
9
|
-
"&").replace(N,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")}function
|
10
|
-
c(
|
11
|
-
|
12
|
-
|
13
|
-
m.push(b),m.push('" '));m.push('href="');m.push(a);m.push('">');g(c);m.push("</a>")}if(!c)return c;for(var l,k=c,m=[],p
|
14
|
-
//# sourceMappingURL=angular-sanitize.min.js.map
|
6
|
+
(function(p,h,q){'use strict';function E(a){var e=[];s(e,h.noop).chars(a);return e.join("")}function k(a){var e={};a=a.split(",");var d;for(d=0;d<a.length;d++)e[a[d]]=!0;return e}function F(a,e){function d(a,b,d,g){b=h.lowercase(b);if(t[b])for(;f.last()&&u[f.last()];)c("",f.last());v[b]&&f.last()==b&&c("",b);(g=w[b]||!!g)||f.push(b);var l={};d.replace(G,function(a,b,e,c,d){l[b]=r(e||c||d||"")});e.start&&e.start(b,l,g)}function c(a,b){var c=0,d;if(b=h.lowercase(b))for(c=f.length-1;0<=c&&f[c]!=b;c--);
|
7
|
+
if(0<=c){for(d=f.length-1;d>=c;d--)e.end&&e.end(f[d]);f.length=c}}var b,g,f=[],l=a;for(f.last=function(){return f[f.length-1]};a;){g=!0;if(f.last()&&x[f.last()])a=a.replace(RegExp("(.*)<\\s*\\/\\s*"+f.last()+"[^>]*>","i"),function(b,a){a=a.replace(H,"$1").replace(I,"$1");e.chars&&e.chars(r(a));return""}),c("",f.last());else{if(0===a.indexOf("\x3c!--"))b=a.indexOf("--",4),0<=b&&a.lastIndexOf("--\x3e",b)===b&&(e.comment&&e.comment(a.substring(4,b)),a=a.substring(b+3),g=!1);else if(y.test(a)){if(b=a.match(y))a=
|
8
|
+
a.replace(b[0],""),g=!1}else if(J.test(a)){if(b=a.match(z))a=a.substring(b[0].length),b[0].replace(z,c),g=!1}else K.test(a)&&(b=a.match(A))&&(a=a.substring(b[0].length),b[0].replace(A,d),g=!1);g&&(b=a.indexOf("<"),g=0>b?a:a.substring(0,b),a=0>b?"":a.substring(b),e.chars&&e.chars(r(g)))}if(a==l)throw L("badparse",a);l=a}c()}function r(a){if(!a)return"";var e=M.exec(a);a=e[1];var d=e[3];if(e=e[2])n.innerHTML=e.replace(/</g,"<"),e="textContent"in n?n.textContent:n.innerText;return a+e+d}function B(a){return a.replace(/&/g,
|
9
|
+
"&").replace(N,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")}function s(a,e){var d=!1,c=h.bind(a,a.push);return{start:function(a,g,f){a=h.lowercase(a);!d&&x[a]&&(d=a);d||!0!==C[a]||(c("<"),c(a),h.forEach(g,function(d,f){var g=h.lowercase(f),k="img"===a&&"src"===g||"background"===g;!0!==O[g]||!0===D[g]&&!e(d,k)||(c(" "),c(f),c('="'),c(B(d)),c('"'))}),c(f?"/>":">"))},end:function(a){a=h.lowercase(a);d||!0!==C[a]||(c("</"),c(a),c(">"));a==d&&(d=!1)},chars:function(a){d||
|
10
|
+
c(B(a))}}}var L=h.$$minErr("$sanitize"),A=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,z=/^<\s*\/\s*([\w:-]+)[^>]*>/,G=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,K=/^</,J=/^<\s*\//,H=/\x3c!--(.*?)--\x3e/g,y=/<!DOCTYPE([^>]*?)>/i,I=/<!\[CDATA\[(.*?)]]\x3e/g,N=/([^\#-~| |!])/g,w=k("area,br,col,hr,img,wbr");p=k("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr");q=k("rp,rt");var v=h.extend({},q,p),t=h.extend({},p,k("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")),
|
11
|
+
u=h.extend({},q,k("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),x=k("script,style"),C=h.extend({},w,t,u,v),D=k("background,cite,href,longdesc,src,usemap"),O=h.extend({},D,k("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,span,start,summary,target,title,type,valign,value,vspace,width")),
|
12
|
+
n=document.createElement("pre"),M=/^(\s*)([\s\S]*?)(\s*)$/;h.module("ngSanitize",[]).provider("$sanitize",function(){this.$get=["$$sanitizeUri",function(a){return function(e){var d=[];F(e,s(d,function(c,b){return!/^unsafe/.test(a(c,b))}));return d.join("")}}]});h.module("ngSanitize").filter("linky",["$sanitize",function(a){var e=/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/,d=/^mailto:/;return function(c,b){function g(a){a&&m.push(E(a))}function f(a,c){m.push("<a ");h.isDefined(b)&&
|
13
|
+
(m.push('target="'),m.push(b),m.push('" '));m.push('href="');m.push(a);m.push('">');g(c);m.push("</a>")}if(!c)return c;for(var l,k=c,m=[],n,p;l=k.match(e);)n=l[0],l[2]==l[3]&&(n="mailto:"+n),p=l.index,g(k.substr(0,p)),f(n,l[0].replace(d,"")),k=k.substring(p+l[0].length);g(k);return a(m.join(""))}}])})(window,window.angular);
|
@@ -9790,7 +9790,7 @@ if ( typeof module === "object" && module && typeof module.exports === "object"
|
|
9790
9790
|
})( window );
|
9791
9791
|
|
9792
9792
|
/**
|
9793
|
-
* @license AngularJS v1.2.
|
9793
|
+
* @license AngularJS v1.2.5
|
9794
9794
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
9795
9795
|
* License: MIT
|
9796
9796
|
*/
|
@@ -9860,7 +9860,7 @@ function minErr(module) {
|
|
9860
9860
|
return match;
|
9861
9861
|
});
|
9862
9862
|
|
9863
|
-
message = message + '\nhttp://errors.angularjs.org/1.2.
|
9863
|
+
message = message + '\nhttp://errors.angularjs.org/1.2.5/' +
|
9864
9864
|
(module ? module + '/' : '') + code;
|
9865
9865
|
for (i = 2; i < arguments.length; i++) {
|
9866
9866
|
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
|
@@ -10264,7 +10264,7 @@ function valueFn(value) {return function() {return value;};}
|
|
10264
10264
|
* @param {*} value Reference to check.
|
10265
10265
|
* @returns {boolean} True if `value` is undefined.
|
10266
10266
|
*/
|
10267
|
-
function isUndefined(value){return typeof value
|
10267
|
+
function isUndefined(value){return typeof value === 'undefined';}
|
10268
10268
|
|
10269
10269
|
|
10270
10270
|
/**
|
@@ -10278,7 +10278,7 @@ function isUndefined(value){return typeof value == 'undefined';}
|
|
10278
10278
|
* @param {*} value Reference to check.
|
10279
10279
|
* @returns {boolean} True if `value` is defined.
|
10280
10280
|
*/
|
10281
|
-
function isDefined(value){return typeof value
|
10281
|
+
function isDefined(value){return typeof value !== 'undefined';}
|
10282
10282
|
|
10283
10283
|
|
10284
10284
|
/**
|
@@ -10293,7 +10293,7 @@ function isDefined(value){return typeof value != 'undefined';}
|
|
10293
10293
|
* @param {*} value Reference to check.
|
10294
10294
|
* @returns {boolean} True if `value` is an `Object` but not `null`.
|
10295
10295
|
*/
|
10296
|
-
function isObject(value){return value != null && typeof value
|
10296
|
+
function isObject(value){return value != null && typeof value === 'object';}
|
10297
10297
|
|
10298
10298
|
|
10299
10299
|
/**
|
@@ -10307,7 +10307,7 @@ function isObject(value){return value != null && typeof value == 'object';}
|
|
10307
10307
|
* @param {*} value Reference to check.
|
10308
10308
|
* @returns {boolean} True if `value` is a `String`.
|
10309
10309
|
*/
|
10310
|
-
function isString(value){return typeof value
|
10310
|
+
function isString(value){return typeof value === 'string';}
|
10311
10311
|
|
10312
10312
|
|
10313
10313
|
/**
|
@@ -10321,7 +10321,7 @@ function isString(value){return typeof value == 'string';}
|
|
10321
10321
|
* @param {*} value Reference to check.
|
10322
10322
|
* @returns {boolean} True if `value` is a `Number`.
|
10323
10323
|
*/
|
10324
|
-
function isNumber(value){return typeof value
|
10324
|
+
function isNumber(value){return typeof value === 'number';}
|
10325
10325
|
|
10326
10326
|
|
10327
10327
|
/**
|
@@ -10336,7 +10336,7 @@ function isNumber(value){return typeof value == 'number';}
|
|
10336
10336
|
* @returns {boolean} True if `value` is a `Date`.
|
10337
10337
|
*/
|
10338
10338
|
function isDate(value){
|
10339
|
-
return toString.
|
10339
|
+
return toString.call(value) === '[object Date]';
|
10340
10340
|
}
|
10341
10341
|
|
10342
10342
|
|
@@ -10352,7 +10352,7 @@ function isDate(value){
|
|
10352
10352
|
* @returns {boolean} True if `value` is an `Array`.
|
10353
10353
|
*/
|
10354
10354
|
function isArray(value) {
|
10355
|
-
return toString.
|
10355
|
+
return toString.call(value) === '[object Array]';
|
10356
10356
|
}
|
10357
10357
|
|
10358
10358
|
|
@@ -10367,7 +10367,7 @@ function isArray(value) {
|
|
10367
10367
|
* @param {*} value Reference to check.
|
10368
10368
|
* @returns {boolean} True if `value` is a `Function`.
|
10369
10369
|
*/
|
10370
|
-
function isFunction(value){return typeof value
|
10370
|
+
function isFunction(value){return typeof value === 'function';}
|
10371
10371
|
|
10372
10372
|
|
10373
10373
|
/**
|
@@ -10378,7 +10378,7 @@ function isFunction(value){return typeof value == 'function';}
|
|
10378
10378
|
* @returns {boolean} True if `value` is a `RegExp`.
|
10379
10379
|
*/
|
10380
10380
|
function isRegExp(value) {
|
10381
|
-
return toString.
|
10381
|
+
return toString.call(value) === '[object RegExp]';
|
10382
10382
|
}
|
10383
10383
|
|
10384
10384
|
|
@@ -10400,12 +10400,12 @@ function isScope(obj) {
|
|
10400
10400
|
|
10401
10401
|
|
10402
10402
|
function isFile(obj) {
|
10403
|
-
return toString.
|
10403
|
+
return toString.call(obj) === '[object File]';
|
10404
10404
|
}
|
10405
10405
|
|
10406
10406
|
|
10407
10407
|
function isBoolean(value) {
|
10408
|
-
return typeof value
|
10408
|
+
return typeof value === 'boolean';
|
10409
10409
|
}
|
10410
10410
|
|
10411
10411
|
|
@@ -10436,9 +10436,9 @@ var trim = (function() {
|
|
10436
10436
|
* @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
|
10437
10437
|
*/
|
10438
10438
|
function isElement(node) {
|
10439
|
-
return node &&
|
10439
|
+
return !!(node &&
|
10440
10440
|
(node.nodeName // we are a direct element
|
10441
|
-
|| (node.on && node.find)); // we have an on and find method part of jQuery API
|
10441
|
+
|| (node.on && node.find))); // we have an on and find method part of jQuery API
|
10442
10442
|
}
|
10443
10443
|
|
10444
10444
|
/**
|
@@ -10509,7 +10509,7 @@ function includes(array, obj) {
|
|
10509
10509
|
function indexOf(array, obj) {
|
10510
10510
|
if (array.indexOf) return array.indexOf(obj);
|
10511
10511
|
|
10512
|
-
for (
|
10512
|
+
for (var i = 0; i < array.length; i++) {
|
10513
10513
|
if (obj === array[i]) return i;
|
10514
10514
|
}
|
10515
10515
|
return -1;
|
@@ -10639,7 +10639,7 @@ function shallowCopy(src, dst) {
|
|
10639
10639
|
|
10640
10640
|
for(var key in src) {
|
10641
10641
|
// shallowCopy is only ever called by $compile nodeLinkFn, which has control over src
|
10642
|
-
// so we don't need to worry hasOwnProperty here
|
10642
|
+
// so we don't need to worry about using our custom hasOwnProperty here
|
10643
10643
|
if (src.hasOwnProperty(key) && key.substr(0, 2) !== '$$') {
|
10644
10644
|
dst[key] = src[key];
|
10645
10645
|
}
|
@@ -10845,7 +10845,7 @@ function startingTag(element) {
|
|
10845
10845
|
try {
|
10846
10846
|
// turns out IE does not let you set .html() on elements which
|
10847
10847
|
// are not allowed to have children. So we just ignore it.
|
10848
|
-
element.
|
10848
|
+
element.empty();
|
10849
10849
|
} catch(e) {}
|
10850
10850
|
// As Per DOM Standards
|
10851
10851
|
var TEXT_NODE = 3;
|
@@ -11201,23 +11201,25 @@ function getter(obj, path, bindFnToScope) {
|
|
11201
11201
|
}
|
11202
11202
|
|
11203
11203
|
/**
|
11204
|
-
* Return the siblings between
|
11205
|
-
* @param {
|
11204
|
+
* Return the DOM siblings between the first and last node in the given array.
|
11205
|
+
* @param {Array} array like object
|
11206
11206
|
* @returns jQlite object containing the elements
|
11207
11207
|
*/
|
11208
|
-
function getBlockElements(
|
11209
|
-
|
11210
|
-
|
11208
|
+
function getBlockElements(nodes) {
|
11209
|
+
var startNode = nodes[0],
|
11210
|
+
endNode = nodes[nodes.length - 1];
|
11211
|
+
if (startNode === endNode) {
|
11212
|
+
return jqLite(startNode);
|
11211
11213
|
}
|
11212
11214
|
|
11213
|
-
var element =
|
11215
|
+
var element = startNode;
|
11214
11216
|
var elements = [element];
|
11215
11217
|
|
11216
11218
|
do {
|
11217
11219
|
element = element.nextSibling;
|
11218
11220
|
if (!element) break;
|
11219
11221
|
elements.push(element);
|
11220
|
-
} while (element !==
|
11222
|
+
} while (element !== endNode);
|
11221
11223
|
|
11222
11224
|
return jqLite(elements);
|
11223
11225
|
}
|
@@ -11557,6 +11559,7 @@ function setupModuleLoader(window) {
|
|
11557
11559
|
ngHideDirective,
|
11558
11560
|
ngIfDirective,
|
11559
11561
|
ngIncludeDirective,
|
11562
|
+
ngIncludeFillContentDirective,
|
11560
11563
|
ngInitDirective,
|
11561
11564
|
ngNonBindableDirective,
|
11562
11565
|
ngPluralizeDirective,
|
@@ -11618,11 +11621,11 @@ function setupModuleLoader(window) {
|
|
11618
11621
|
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
|
11619
11622
|
*/
|
11620
11623
|
var version = {
|
11621
|
-
full: '1.2.
|
11624
|
+
full: '1.2.5', // all of these placeholder strings will be replaced by grunt's
|
11622
11625
|
major: 1, // package task
|
11623
11626
|
minor: 2,
|
11624
|
-
dot:
|
11625
|
-
codeName: '
|
11627
|
+
dot: 5,
|
11628
|
+
codeName: 'singularity-expansion'
|
11626
11629
|
};
|
11627
11630
|
|
11628
11631
|
|
@@ -11710,6 +11713,9 @@ function publishExternalAPI(angular){
|
|
11710
11713
|
ngRequired: requiredDirective,
|
11711
11714
|
ngValue: ngValueDirective
|
11712
11715
|
}).
|
11716
|
+
directive({
|
11717
|
+
ngInclude: ngIncludeFillContentDirective
|
11718
|
+
}).
|
11713
11719
|
directive(ngAttributeAliasDirectives).
|
11714
11720
|
directive(ngEventDirectives);
|
11715
11721
|
$provide.provider({
|
@@ -11787,6 +11793,7 @@ function publishExternalAPI(angular){
|
|
11787
11793
|
* - [`contents()`](http://api.jquery.com/contents/)
|
11788
11794
|
* - [`css()`](http://api.jquery.com/css/)
|
11789
11795
|
* - [`data()`](http://api.jquery.com/data/)
|
11796
|
+
* - [`empty()`](http://api.jquery.com/empty/)
|
11790
11797
|
* - [`eq()`](http://api.jquery.com/eq/)
|
11791
11798
|
* - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name
|
11792
11799
|
* - [`hasClass()`](http://api.jquery.com/hasClass/)
|
@@ -12099,6 +12106,15 @@ function jqLiteInheritedData(element, name, value) {
|
|
12099
12106
|
}
|
12100
12107
|
}
|
12101
12108
|
|
12109
|
+
function jqLiteEmpty(element) {
|
12110
|
+
for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {
|
12111
|
+
jqLiteDealoc(childNodes[i]);
|
12112
|
+
}
|
12113
|
+
while (element.firstChild) {
|
12114
|
+
element.removeChild(element.firstChild);
|
12115
|
+
}
|
12116
|
+
}
|
12117
|
+
|
12102
12118
|
//////////////////////////////////////////
|
12103
12119
|
// Functions which are declared directly.
|
12104
12120
|
//////////////////////////////////////////
|
@@ -12293,7 +12309,9 @@ forEach({
|
|
12293
12309
|
jqLiteDealoc(childNodes[i]);
|
12294
12310
|
}
|
12295
12311
|
element.innerHTML = value;
|
12296
|
-
}
|
12312
|
+
},
|
12313
|
+
|
12314
|
+
empty: jqLiteEmpty
|
12297
12315
|
}, function(fn, name){
|
12298
12316
|
/**
|
12299
12317
|
* Properties: writes return selection, reads return first value
|
@@ -12303,11 +12321,13 @@ forEach({
|
|
12303
12321
|
|
12304
12322
|
// jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
|
12305
12323
|
// in a way that survives minification.
|
12306
|
-
|
12324
|
+
// jqLiteEmpty takes no arguments but is a setter.
|
12325
|
+
if (fn !== jqLiteEmpty &&
|
12326
|
+
(((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2) === undefined)) {
|
12307
12327
|
if (isObject(arg1)) {
|
12308
12328
|
|
12309
12329
|
// we are a write, but the object properties are the key/values
|
12310
|
-
for(i=0; i < this.length; i++) {
|
12330
|
+
for (i = 0; i < this.length; i++) {
|
12311
12331
|
if (fn === jqLiteData) {
|
12312
12332
|
// data() takes the whole object in jQuery
|
12313
12333
|
fn(this[i], arg1);
|
@@ -12332,7 +12352,7 @@ forEach({
|
|
12332
12352
|
}
|
12333
12353
|
} else {
|
12334
12354
|
// we are a write, so apply to all children
|
12335
|
-
for(i=0; i < this.length; i++) {
|
12355
|
+
for (i = 0; i < this.length; i++) {
|
12336
12356
|
fn(this[i], arg1, arg2);
|
12337
12357
|
}
|
12338
12358
|
// return self for chaining
|
@@ -12563,7 +12583,11 @@ forEach({
|
|
12563
12583
|
},
|
12564
12584
|
|
12565
12585
|
find: function(element, selector) {
|
12566
|
-
|
12586
|
+
if (element.getElementsByTagName) {
|
12587
|
+
return element.getElementsByTagName(selector);
|
12588
|
+
} else {
|
12589
|
+
return [];
|
12590
|
+
}
|
12567
12591
|
},
|
12568
12592
|
|
12569
12593
|
clone: jqLiteClone,
|
@@ -12699,6 +12723,28 @@ HashMap.prototype = {
|
|
12699
12723
|
* $rootScope.$digest();
|
12700
12724
|
* });
|
12701
12725
|
* </pre>
|
12726
|
+
*
|
12727
|
+
* Sometimes you want to get access to the injector of a currently running Angular app
|
12728
|
+
* from outside Angular. Perhaps, you want to inject and compile some markup after the
|
12729
|
+
* application has been bootstrapped. You can do this using extra `injector()` added
|
12730
|
+
* to JQuery/jqLite elements. See {@link angular.element}.
|
12731
|
+
*
|
12732
|
+
* *This is fairly rare but could be the case if a third party library is injecting the
|
12733
|
+
* markup.*
|
12734
|
+
*
|
12735
|
+
* In the following example a new block of HTML containing a `ng-controller`
|
12736
|
+
* directive is added to the end of the document body by JQuery. We then compile and link
|
12737
|
+
* it into the current AngularJS scope.
|
12738
|
+
*
|
12739
|
+
* <pre>
|
12740
|
+
* var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
|
12741
|
+
* $(document.body).append($div);
|
12742
|
+
*
|
12743
|
+
* angular.element(document).injector().invoke(function($compile) {
|
12744
|
+
* var scope = angular.element($div).scope();
|
12745
|
+
* $compile($div)(scope);
|
12746
|
+
* });
|
12747
|
+
* </pre>
|
12702
12748
|
*/
|
12703
12749
|
|
12704
12750
|
|
@@ -12893,7 +12939,7 @@ function annotate(fn) {
|
|
12893
12939
|
* // ...
|
12894
12940
|
* }
|
12895
12941
|
* // Define function dependencies
|
12896
|
-
* MyController
|
12942
|
+
* MyController['$inject'] = ['$scope', '$route'];
|
12897
12943
|
*
|
12898
12944
|
* // Then
|
12899
12945
|
* expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
|
@@ -13419,24 +13465,9 @@ function createInjector(modulesToLoad) {
|
|
13419
13465
|
fn = fn[length];
|
13420
13466
|
}
|
13421
13467
|
|
13422
|
-
|
13423
|
-
//
|
13424
|
-
|
13425
|
-
case 0: return fn();
|
13426
|
-
case 1: return fn(args[0]);
|
13427
|
-
case 2: return fn(args[0], args[1]);
|
13428
|
-
case 3: return fn(args[0], args[1], args[2]);
|
13429
|
-
case 4: return fn(args[0], args[1], args[2], args[3]);
|
13430
|
-
case 5: return fn(args[0], args[1], args[2], args[3], args[4]);
|
13431
|
-
case 6: return fn(args[0], args[1], args[2], args[3], args[4], args[5]);
|
13432
|
-
case 7: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
13433
|
-
case 8: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
13434
|
-
case 9: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
|
13435
|
-
args[8]);
|
13436
|
-
case 10: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
|
13437
|
-
args[8], args[9]);
|
13438
|
-
default: return fn.apply(self, args);
|
13439
|
-
}
|
13468
|
+
// http://jsperf.com/angularjs-invoke-apply-vs-switch
|
13469
|
+
// #5388
|
13470
|
+
return fn.apply(self, args);
|
13440
13471
|
}
|
13441
13472
|
|
13442
13473
|
function instantiate(Type, locals) {
|
@@ -14595,7 +14626,7 @@ function $TemplateCacheProvider() {
|
|
14595
14626
|
* * (no prefix) - Locate the required controller on the current element. Throw an error if not found.
|
14596
14627
|
* * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
|
14597
14628
|
* * `^` - Locate the required controller by searching the element's parents. Throw an error if not found.
|
14598
|
-
* * `?^` - Attempt to locate the required controller by searching the element's
|
14629
|
+
* * `?^` - Attempt to locate the required controller by searching the element's parents or pass `null` to the
|
14599
14630
|
* `link` fn if not found.
|
14600
14631
|
*
|
14601
14632
|
*
|
@@ -15334,7 +15365,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
15334
15365
|
createBoundTranscludeFn(scope, childTranscludeFn || transcludeFn)
|
15335
15366
|
);
|
15336
15367
|
} else {
|
15337
|
-
nodeLinkFn(childLinkFn, childScope, node,
|
15368
|
+
nodeLinkFn(childLinkFn, childScope, node, $rootElement, boundTranscludeFn);
|
15338
15369
|
}
|
15339
15370
|
} else if (childLinkFn) {
|
15340
15371
|
childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn);
|
@@ -15622,7 +15653,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
15622
15653
|
});
|
15623
15654
|
} else {
|
15624
15655
|
$template = jqLite(jqLiteClone(compileNode)).contents();
|
15625
|
-
$compileNode.
|
15656
|
+
$compileNode.empty(); // clear contents
|
15626
15657
|
childTranscludeFn = compile($template, transcludeFn);
|
15627
15658
|
}
|
15628
15659
|
}
|
@@ -15803,7 +15834,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
15803
15834
|
optional = (match[2] == '?'),
|
15804
15835
|
mode = match[1], // @, =, or &
|
15805
15836
|
lastValue,
|
15806
|
-
parentGet, parentSet;
|
15837
|
+
parentGet, parentSet, compare;
|
15807
15838
|
|
15808
15839
|
isolateScope.$$isolateBindings[scopeName] = mode + attrName;
|
15809
15840
|
|
@@ -15826,6 +15857,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
15826
15857
|
return;
|
15827
15858
|
}
|
15828
15859
|
parentGet = $parse(attrs[attrName]);
|
15860
|
+
if (parentGet.literal) {
|
15861
|
+
compare = equals;
|
15862
|
+
} else {
|
15863
|
+
compare = function(a,b) { return a === b; };
|
15864
|
+
}
|
15829
15865
|
parentSet = parentGet.assign || function() {
|
15830
15866
|
// reset the change, or we will throw this exception on every $digest
|
15831
15867
|
lastValue = isolateScope[scopeName] = parentGet(scope);
|
@@ -15836,19 +15872,18 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
15836
15872
|
lastValue = isolateScope[scopeName] = parentGet(scope);
|
15837
15873
|
isolateScope.$watch(function parentValueWatch() {
|
15838
15874
|
var parentValue = parentGet(scope);
|
15839
|
-
|
15840
|
-
if (parentValue !== isolateScope[scopeName]) {
|
15875
|
+
if (!compare(parentValue, isolateScope[scopeName])) {
|
15841
15876
|
// we are out of sync and need to copy
|
15842
|
-
if (parentValue
|
15877
|
+
if (!compare(parentValue, lastValue)) {
|
15843
15878
|
// parent changed and it has precedence
|
15844
|
-
|
15879
|
+
isolateScope[scopeName] = parentValue;
|
15845
15880
|
} else {
|
15846
15881
|
// if the parent can be assigned then do so
|
15847
|
-
parentSet(scope, parentValue =
|
15882
|
+
parentSet(scope, parentValue = isolateScope[scopeName]);
|
15848
15883
|
}
|
15849
15884
|
}
|
15850
|
-
return parentValue;
|
15851
|
-
});
|
15885
|
+
return lastValue = parentValue;
|
15886
|
+
}, null, parentGet.literal);
|
15852
15887
|
break;
|
15853
15888
|
|
15854
15889
|
case '&':
|
@@ -16050,7 +16085,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
16050
16085
|
? origAsyncDirective.templateUrl($compileNode, tAttrs)
|
16051
16086
|
: origAsyncDirective.templateUrl;
|
16052
16087
|
|
16053
|
-
$compileNode.
|
16088
|
+
$compileNode.empty();
|
16054
16089
|
|
16055
16090
|
$http.get($sce.getTrustedResourceUrl(templateUrl), {cache: $templateCache}).
|
16056
16091
|
success(function(content) {
|
@@ -17840,8 +17875,8 @@ function $InterpolateProvider() {
|
|
17840
17875
|
*
|
17841
17876
|
<pre>
|
17842
17877
|
var $interpolate = ...; // injected
|
17843
|
-
var exp = $interpolate('Hello {{name}}!');
|
17844
|
-
expect(exp({name:'Angular'}).toEqual('Hello
|
17878
|
+
var exp = $interpolate('Hello {{name | uppercase}}!');
|
17879
|
+
expect(exp({name:'Angular'}).toEqual('Hello ANGULAR!');
|
17845
17880
|
</pre>
|
17846
17881
|
*
|
17847
17882
|
*
|
@@ -19039,23 +19074,24 @@ function ensureSafeMemberName(name, fullExpression) {
|
|
19039
19074
|
|
19040
19075
|
function ensureSafeObject(obj, fullExpression) {
|
19041
19076
|
// nifty check if obj is Function that is fast and works across iframes and other contexts
|
19042
|
-
if (obj
|
19043
|
-
|
19044
|
-
|
19045
|
-
|
19046
|
-
|
19047
|
-
|
19048
|
-
|
19049
|
-
|
19050
|
-
|
19051
|
-
|
19052
|
-
|
19053
|
-
|
19054
|
-
|
19055
|
-
|
19056
|
-
|
19057
|
-
|
19077
|
+
if (obj) {
|
19078
|
+
if (obj.constructor === obj) {
|
19079
|
+
throw $parseMinErr('isecfn',
|
19080
|
+
'Referencing Function in Angular expressions is disallowed! Expression: {0}',
|
19081
|
+
fullExpression);
|
19082
|
+
} else if (// isWindow(obj)
|
19083
|
+
obj.document && obj.location && obj.alert && obj.setInterval) {
|
19084
|
+
throw $parseMinErr('isecwindow',
|
19085
|
+
'Referencing the Window in Angular expressions is disallowed! Expression: {0}',
|
19086
|
+
fullExpression);
|
19087
|
+
} else if (// isElement(obj)
|
19088
|
+
obj.children && (obj.nodeName || (obj.on && obj.find))) {
|
19089
|
+
throw $parseMinErr('isecdom',
|
19090
|
+
'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',
|
19091
|
+
fullExpression);
|
19092
|
+
}
|
19058
19093
|
}
|
19094
|
+
return obj;
|
19059
19095
|
}
|
19060
19096
|
|
19061
19097
|
var OPERATORS = {
|
@@ -20364,7 +20400,7 @@ function $ParseProvider() {
|
|
20364
20400
|
*
|
20365
20401
|
* # Differences between Kris Kowal's Q and $q
|
20366
20402
|
*
|
20367
|
-
* There are
|
20403
|
+
* There are two main differences:
|
20368
20404
|
*
|
20369
20405
|
* - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
|
20370
20406
|
* mechanism in angular, which means faster propagation of resolution or rejection into your
|
@@ -20813,6 +20849,7 @@ function qFactory(nextTick, exceptionHandler) {
|
|
20813
20849
|
function $RootScopeProvider(){
|
20814
20850
|
var TTL = 10;
|
20815
20851
|
var $rootScopeMinErr = minErr('$rootScope');
|
20852
|
+
var lastDirtyWatch = null;
|
20816
20853
|
|
20817
20854
|
this.digestTtl = function(value) {
|
20818
20855
|
if (arguments.length) {
|
@@ -20897,11 +20934,11 @@ function $RootScopeProvider(){
|
|
20897
20934
|
* @description
|
20898
20935
|
* Creates a new child {@link ng.$rootScope.Scope scope}.
|
20899
20936
|
*
|
20900
|
-
* The parent scope will propagate the {@link ng.$rootScope.Scope
|
20901
|
-
* {@link ng.$rootScope.Scope
|
20902
|
-
* scope hierarchy using {@link ng.$rootScope.Scope
|
20937
|
+
* The parent scope will propagate the {@link ng.$rootScope.Scope#methods_$digest $digest()} and
|
20938
|
+
* {@link ng.$rootScope.Scope#methods_$digest $digest()} events. The scope can be removed from the
|
20939
|
+
* scope hierarchy using {@link ng.$rootScope.Scope#methods_$destroy $destroy()}.
|
20903
20940
|
*
|
20904
|
-
* {@link ng.$rootScope.Scope
|
20941
|
+
* {@link ng.$rootScope.Scope#methods_$destroy $destroy()} must be called on a scope when it is
|
20905
20942
|
* desired for the scope and its child scopes to be permanently detached from the parent and
|
20906
20943
|
* thus stop participating in model change detection and listener notification by invoking.
|
20907
20944
|
*
|
@@ -20914,7 +20951,7 @@ function $RootScopeProvider(){
|
|
20914
20951
|
*
|
20915
20952
|
*/
|
20916
20953
|
$new: function(isolate) {
|
20917
|
-
var
|
20954
|
+
var ChildScope,
|
20918
20955
|
child;
|
20919
20956
|
|
20920
20957
|
if (isolate) {
|
@@ -20924,11 +20961,11 @@ function $RootScopeProvider(){
|
|
20924
20961
|
child.$$asyncQueue = this.$$asyncQueue;
|
20925
20962
|
child.$$postDigestQueue = this.$$postDigestQueue;
|
20926
20963
|
} else {
|
20927
|
-
|
20964
|
+
ChildScope = function() {}; // should be anonymous; This is so that when the minifier munges
|
20928
20965
|
// the name it does not become random set of chars. This will then show up as class
|
20929
20966
|
// name in the debugger.
|
20930
|
-
|
20931
|
-
child = new
|
20967
|
+
ChildScope.prototype = this;
|
20968
|
+
child = new ChildScope();
|
20932
20969
|
child.$id = nextUid();
|
20933
20970
|
}
|
20934
20971
|
child['this'] = child;
|
@@ -20954,11 +20991,11 @@ function $RootScopeProvider(){
|
|
20954
20991
|
* @description
|
20955
20992
|
* Registers a `listener` callback to be executed whenever the `watchExpression` changes.
|
20956
20993
|
*
|
20957
|
-
* - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope
|
20994
|
+
* - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#methods_$digest
|
20958
20995
|
* $digest()} and should return the value that will be watched. (Since
|
20959
|
-
* {@link ng.$rootScope.Scope
|
20996
|
+
* {@link ng.$rootScope.Scope#methods_$digest $digest()} reruns when it detects changes the
|
20960
20997
|
* `watchExpression` can execute multiple times per
|
20961
|
-
* {@link ng.$rootScope.Scope
|
20998
|
+
* {@link ng.$rootScope.Scope#methods_$digest $digest()} and should be idempotent.)
|
20962
20999
|
* - The `listener` is called only when the value from the current `watchExpression` and the
|
20963
21000
|
* previous call to `watchExpression` are not equal (with the exception of the initial run,
|
20964
21001
|
* see below). The inequality is determined according to
|
@@ -20970,13 +21007,13 @@ function $RootScopeProvider(){
|
|
20970
21007
|
* iteration limit is 10 to prevent an infinite loop deadlock.
|
20971
21008
|
*
|
20972
21009
|
*
|
20973
|
-
* If you want to be notified whenever {@link ng.$rootScope.Scope
|
21010
|
+
* If you want to be notified whenever {@link ng.$rootScope.Scope#methods_$digest $digest} is called,
|
20974
21011
|
* you can register a `watchExpression` function with no `listener`. (Since `watchExpression`
|
20975
|
-
* can execute multiple times per {@link ng.$rootScope.Scope
|
21012
|
+
* can execute multiple times per {@link ng.$rootScope.Scope#methods_$digest $digest} cycle when a
|
20976
21013
|
* change is detected, be prepared for multiple calls to your listener.)
|
20977
21014
|
*
|
20978
21015
|
* After a watcher is registered with the scope, the `listener` fn is called asynchronously
|
20979
|
-
* (via {@link ng.$rootScope.Scope
|
21016
|
+
* (via {@link ng.$rootScope.Scope#methods_$evalAsync $evalAsync}) to initialize the
|
20980
21017
|
* watcher. In rare cases, this is undesirable because the listener is called when the result
|
20981
21018
|
* of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
|
20982
21019
|
* can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
|
@@ -21008,7 +21045,7 @@ function $RootScopeProvider(){
|
|
21008
21045
|
|
21009
21046
|
|
21010
21047
|
|
21011
|
-
// Using a listener function
|
21048
|
+
// Using a listener function
|
21012
21049
|
var food;
|
21013
21050
|
scope.foodCounter = 0;
|
21014
21051
|
expect(scope.foodCounter).toEqual(0);
|
@@ -21033,14 +21070,14 @@ function $RootScopeProvider(){
|
|
21033
21070
|
// Update food and run digest. Now the counter will increment
|
21034
21071
|
food = 'cheeseburger';
|
21035
21072
|
scope.$digest();
|
21036
|
-
expect(scope.foodCounter).toEqual(1);
|
21073
|
+
expect(scope.foodCounter).toEqual(1);
|
21037
21074
|
|
21038
21075
|
* </pre>
|
21039
21076
|
*
|
21040
21077
|
*
|
21041
21078
|
*
|
21042
21079
|
* @param {(function()|string)} watchExpression Expression that is evaluated on each
|
21043
|
-
* {@link ng.$rootScope.Scope
|
21080
|
+
* {@link ng.$rootScope.Scope#methods_$digest $digest} cycle. A change in the return value triggers
|
21044
21081
|
* a call to the `listener`.
|
21045
21082
|
*
|
21046
21083
|
* - `string`: Evaluated as {@link guide/expression expression}
|
@@ -21067,6 +21104,8 @@ function $RootScopeProvider(){
|
|
21067
21104
|
eq: !!objectEquality
|
21068
21105
|
};
|
21069
21106
|
|
21107
|
+
lastDirtyWatch = null;
|
21108
|
+
|
21070
21109
|
// in the case user pass string, we need to compile it, do we really need this ?
|
21071
21110
|
if (!isFunction(listener)) {
|
21072
21111
|
var listenFn = compileToFn(listener || noop, 'listener');
|
@@ -21136,7 +21175,7 @@ function $RootScopeProvider(){
|
|
21136
21175
|
*
|
21137
21176
|
* @param {string|Function(scope)} obj Evaluated as {@link guide/expression expression}. The
|
21138
21177
|
* expression value should evaluate to an object or an array which is observed on each
|
21139
|
-
* {@link ng.$rootScope.Scope
|
21178
|
+
* {@link ng.$rootScope.Scope#methods_$digest $digest} cycle. Any shallow change within the
|
21140
21179
|
* collection will trigger a call to the `listener`.
|
21141
21180
|
*
|
21142
21181
|
* @param {function(newCollection, oldCollection, scope)} listener a callback function that is
|
@@ -21241,9 +21280,9 @@ function $RootScopeProvider(){
|
|
21241
21280
|
* @function
|
21242
21281
|
*
|
21243
21282
|
* @description
|
21244
|
-
* Processes all of the {@link ng.$rootScope.Scope
|
21245
|
-
* its children. Because a {@link ng.$rootScope.Scope
|
21246
|
-
* the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope
|
21283
|
+
* Processes all of the {@link ng.$rootScope.Scope#methods_$watch watchers} of the current scope and
|
21284
|
+
* its children. Because a {@link ng.$rootScope.Scope#methods_$watch watcher}'s listener can change
|
21285
|
+
* the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#methods_$watch watchers}
|
21247
21286
|
* until no more listeners are firing. This means that it is possible to get into an infinite
|
21248
21287
|
* loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of
|
21249
21288
|
* iterations exceeds 10.
|
@@ -21251,12 +21290,12 @@ function $RootScopeProvider(){
|
|
21251
21290
|
* Usually, you don't call `$digest()` directly in
|
21252
21291
|
* {@link ng.directive:ngController controllers} or in
|
21253
21292
|
* {@link ng.$compileProvider#methods_directive directives}.
|
21254
|
-
* Instead, you should call {@link ng.$rootScope.Scope
|
21293
|
+
* Instead, you should call {@link ng.$rootScope.Scope#methods_$apply $apply()} (typically from within
|
21255
21294
|
* a {@link ng.$compileProvider#methods_directive directives}), which will force a `$digest()`.
|
21256
21295
|
*
|
21257
21296
|
* If you want to be notified whenever `$digest()` is called,
|
21258
21297
|
* you can register a `watchExpression` function with
|
21259
|
-
* {@link ng.$rootScope.Scope
|
21298
|
+
* {@link ng.$rootScope.Scope#methods_$watch $watch()} with no `listener`.
|
21260
21299
|
*
|
21261
21300
|
* In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
|
21262
21301
|
*
|
@@ -21295,6 +21334,8 @@ function $RootScopeProvider(){
|
|
21295
21334
|
|
21296
21335
|
beginPhase('$digest');
|
21297
21336
|
|
21337
|
+
lastDirtyWatch = null;
|
21338
|
+
|
21298
21339
|
do { // "while dirty" loop
|
21299
21340
|
dirty = false;
|
21300
21341
|
current = target;
|
@@ -21304,10 +21345,13 @@ function $RootScopeProvider(){
|
|
21304
21345
|
asyncTask = asyncQueue.shift();
|
21305
21346
|
asyncTask.scope.$eval(asyncTask.expression);
|
21306
21347
|
} catch (e) {
|
21348
|
+
clearPhase();
|
21307
21349
|
$exceptionHandler(e);
|
21308
21350
|
}
|
21351
|
+
lastDirtyWatch = null;
|
21309
21352
|
}
|
21310
21353
|
|
21354
|
+
traverseScopesLoop:
|
21311
21355
|
do { // "traverse the scopes" loop
|
21312
21356
|
if ((watchers = current.$$watchers)) {
|
21313
21357
|
// process our watches
|
@@ -21317,25 +21361,34 @@ function $RootScopeProvider(){
|
|
21317
21361
|
watch = watchers[length];
|
21318
21362
|
// Most common watches are on primitives, in which case we can short
|
21319
21363
|
// circuit it with === operator, only when === fails do we use .equals
|
21320
|
-
if (watch
|
21321
|
-
|
21322
|
-
|
21323
|
-
|
21324
|
-
|
21325
|
-
|
21326
|
-
|
21327
|
-
|
21328
|
-
|
21329
|
-
|
21330
|
-
if (
|
21331
|
-
|
21332
|
-
|
21333
|
-
|
21334
|
-
|
21335
|
-
|
21364
|
+
if (watch) {
|
21365
|
+
if ((value = watch.get(current)) !== (last = watch.last) &&
|
21366
|
+
!(watch.eq
|
21367
|
+
? equals(value, last)
|
21368
|
+
: (typeof value == 'number' && typeof last == 'number'
|
21369
|
+
&& isNaN(value) && isNaN(last)))) {
|
21370
|
+
dirty = true;
|
21371
|
+
lastDirtyWatch = watch;
|
21372
|
+
watch.last = watch.eq ? copy(value) : value;
|
21373
|
+
watch.fn(value, ((last === initWatchVal) ? value : last), current);
|
21374
|
+
if (ttl < 5) {
|
21375
|
+
logIdx = 4 - ttl;
|
21376
|
+
if (!watchLog[logIdx]) watchLog[logIdx] = [];
|
21377
|
+
logMsg = (isFunction(watch.exp))
|
21378
|
+
? 'fn: ' + (watch.exp.name || watch.exp.toString())
|
21379
|
+
: watch.exp;
|
21380
|
+
logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last);
|
21381
|
+
watchLog[logIdx].push(logMsg);
|
21382
|
+
}
|
21383
|
+
} else if (watch === lastDirtyWatch) {
|
21384
|
+
// If the most recently dirty watcher is now clean, short circuit since the remaining watchers
|
21385
|
+
// have already been tested.
|
21386
|
+
dirty = false;
|
21387
|
+
break traverseScopesLoop;
|
21336
21388
|
}
|
21337
21389
|
}
|
21338
21390
|
} catch (e) {
|
21391
|
+
clearPhase();
|
21339
21392
|
$exceptionHandler(e);
|
21340
21393
|
}
|
21341
21394
|
}
|
@@ -21344,13 +21397,16 @@ function $RootScopeProvider(){
|
|
21344
21397
|
// Insanity Warning: scope depth-first traversal
|
21345
21398
|
// yes, this code is a bit crazy, but it works and we have tests to prove it!
|
21346
21399
|
// this piece should be kept in sync with the traversal in $broadcast
|
21347
|
-
if (!(next = (current.$$childHead ||
|
21400
|
+
if (!(next = (current.$$childHead ||
|
21401
|
+
(current !== target && current.$$nextSibling)))) {
|
21348
21402
|
while(current !== target && !(next = current.$$nextSibling)) {
|
21349
21403
|
current = current.$parent;
|
21350
21404
|
}
|
21351
21405
|
}
|
21352
21406
|
} while ((current = next));
|
21353
21407
|
|
21408
|
+
// `break traverseScopesLoop;` takes us to here
|
21409
|
+
|
21354
21410
|
if(dirty && !(ttl--)) {
|
21355
21411
|
clearPhase();
|
21356
21412
|
throw $rootScopeMinErr('infdig',
|
@@ -21358,6 +21414,7 @@ function $RootScopeProvider(){
|
|
21358
21414
|
'Watchers fired in the last 5 iterations: {1}',
|
21359
21415
|
TTL, toJson(watchLog));
|
21360
21416
|
}
|
21417
|
+
|
21361
21418
|
} while (dirty || asyncQueue.length);
|
21362
21419
|
|
21363
21420
|
clearPhase();
|
@@ -21393,7 +21450,7 @@ function $RootScopeProvider(){
|
|
21393
21450
|
*
|
21394
21451
|
* @description
|
21395
21452
|
* Removes the current scope (and all of its children) from the parent scope. Removal implies
|
21396
|
-
* that calls to {@link ng.$rootScope.Scope
|
21453
|
+
* that calls to {@link ng.$rootScope.Scope#methods_$digest $digest()} will no longer
|
21397
21454
|
* propagate to the current scope and its children. Removal also implies that the current
|
21398
21455
|
* scope is eligible for garbage collection.
|
21399
21456
|
*
|
@@ -21410,11 +21467,12 @@ function $RootScopeProvider(){
|
|
21410
21467
|
*/
|
21411
21468
|
$destroy: function() {
|
21412
21469
|
// we can't destroy the root scope or a scope that has been already destroyed
|
21413
|
-
if (
|
21470
|
+
if (this.$$destroyed) return;
|
21414
21471
|
var parent = this.$parent;
|
21415
21472
|
|
21416
21473
|
this.$broadcast('$destroy');
|
21417
21474
|
this.$$destroyed = true;
|
21475
|
+
if (this === $rootScope) return;
|
21418
21476
|
|
21419
21477
|
if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
|
21420
21478
|
if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
|
@@ -21452,7 +21510,7 @@ function $RootScopeProvider(){
|
|
21452
21510
|
*
|
21453
21511
|
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
|
21454
21512
|
* - `function(scope)`: execute the function with the current `scope` parameter.
|
21455
|
-
*
|
21513
|
+
*
|
21456
21514
|
* @param {(object)=} locals Local variables object, useful for overriding values in scope.
|
21457
21515
|
* @returns {*} The result of evaluating the expression.
|
21458
21516
|
*/
|
@@ -21474,7 +21532,7 @@ function $RootScopeProvider(){
|
|
21474
21532
|
*
|
21475
21533
|
* - it will execute after the function that scheduled the evaluation (preferably before DOM
|
21476
21534
|
* rendering).
|
21477
|
-
* - at least one {@link ng.$rootScope.Scope
|
21535
|
+
* - at least one {@link ng.$rootScope.Scope#methods_$digest $digest cycle} will be performed after
|
21478
21536
|
* `expression` execution.
|
21479
21537
|
*
|
21480
21538
|
* Any exceptions from the execution of the expression are forwarded to the
|
@@ -21519,7 +21577,7 @@ function $RootScopeProvider(){
|
|
21519
21577
|
* framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).
|
21520
21578
|
* Because we are calling into the angular framework we need to perform proper scope life
|
21521
21579
|
* cycle of {@link ng.$exceptionHandler exception handling},
|
21522
|
-
* {@link ng.$rootScope.Scope
|
21580
|
+
* {@link ng.$rootScope.Scope#methods_$digest executing watches}.
|
21523
21581
|
*
|
21524
21582
|
* ## Life cycle
|
21525
21583
|
*
|
@@ -21540,11 +21598,11 @@ function $RootScopeProvider(){
|
|
21540
21598
|
* Scope's `$apply()` method transitions through the following stages:
|
21541
21599
|
*
|
21542
21600
|
* 1. The {@link guide/expression expression} is executed using the
|
21543
|
-
* {@link ng.$rootScope.Scope
|
21601
|
+
* {@link ng.$rootScope.Scope#methods_$eval $eval()} method.
|
21544
21602
|
* 2. Any exceptions from the execution of the expression are forwarded to the
|
21545
21603
|
* {@link ng.$exceptionHandler $exceptionHandler} service.
|
21546
|
-
* 3. The {@link ng.$rootScope.Scope
|
21547
|
-
* expression was executed using the {@link ng.$rootScope.Scope
|
21604
|
+
* 3. The {@link ng.$rootScope.Scope#methods_$watch watch} listeners are fired immediately after the
|
21605
|
+
* expression was executed using the {@link ng.$rootScope.Scope#methods_$digest $digest()} method.
|
21548
21606
|
*
|
21549
21607
|
*
|
21550
21608
|
* @param {(string|function())=} exp An angular expression to be executed.
|
@@ -21578,7 +21636,7 @@ function $RootScopeProvider(){
|
|
21578
21636
|
* @function
|
21579
21637
|
*
|
21580
21638
|
* @description
|
21581
|
-
* Listens on events of a given type. See {@link ng.$rootScope.Scope
|
21639
|
+
* Listens on events of a given type. See {@link ng.$rootScope.Scope#methods_$emit $emit} for
|
21582
21640
|
* discussion of event life cycle.
|
21583
21641
|
*
|
21584
21642
|
* The event listener function format is: `function(event, args...)`. The `event` object
|
@@ -21619,20 +21677,20 @@ function $RootScopeProvider(){
|
|
21619
21677
|
*
|
21620
21678
|
* @description
|
21621
21679
|
* Dispatches an event `name` upwards through the scope hierarchy notifying the
|
21622
|
-
* registered {@link ng.$rootScope.Scope
|
21680
|
+
* registered {@link ng.$rootScope.Scope#methods_$on} listeners.
|
21623
21681
|
*
|
21624
21682
|
* The event life cycle starts at the scope on which `$emit` was called. All
|
21625
|
-
* {@link ng.$rootScope.Scope
|
21683
|
+
* {@link ng.$rootScope.Scope#methods_$on listeners} listening for `name` event on this scope get
|
21626
21684
|
* notified. Afterwards, the event traverses upwards toward the root scope and calls all
|
21627
21685
|
* registered listeners along the way. The event will stop propagating if one of the listeners
|
21628
21686
|
* cancels it.
|
21629
21687
|
*
|
21630
|
-
* Any exception emitted from the {@link ng.$rootScope.Scope
|
21688
|
+
* Any exception emitted from the {@link ng.$rootScope.Scope#methods_$on listeners} will be passed
|
21631
21689
|
* onto the {@link ng.$exceptionHandler $exceptionHandler} service.
|
21632
21690
|
*
|
21633
21691
|
* @param {string} name Event name to emit.
|
21634
21692
|
* @param {...*} args Optional set of arguments which will be passed onto the event listeners.
|
21635
|
-
* @return {Object} Event object (see {@link ng.$rootScope.Scope
|
21693
|
+
* @return {Object} Event object (see {@link ng.$rootScope.Scope#methods_$on}).
|
21636
21694
|
*/
|
21637
21695
|
$emit: function(name, args) {
|
21638
21696
|
var empty = [],
|
@@ -21688,19 +21746,19 @@ function $RootScopeProvider(){
|
|
21688
21746
|
*
|
21689
21747
|
* @description
|
21690
21748
|
* Dispatches an event `name` downwards to all child scopes (and their children) notifying the
|
21691
|
-
* registered {@link ng.$rootScope.Scope
|
21749
|
+
* registered {@link ng.$rootScope.Scope#methods_$on} listeners.
|
21692
21750
|
*
|
21693
21751
|
* The event life cycle starts at the scope on which `$broadcast` was called. All
|
21694
|
-
* {@link ng.$rootScope.Scope
|
21752
|
+
* {@link ng.$rootScope.Scope#methods_$on listeners} listening for `name` event on this scope get
|
21695
21753
|
* notified. Afterwards, the event propagates to all direct and indirect scopes of the current
|
21696
21754
|
* scope and calls all registered listeners along the way. The event cannot be canceled.
|
21697
21755
|
*
|
21698
|
-
* Any exception emitted from the {@link ng.$rootScope.Scope
|
21756
|
+
* Any exception emitted from the {@link ng.$rootScope.Scope#methods_$on listeners} will be passed
|
21699
21757
|
* onto the {@link ng.$exceptionHandler $exceptionHandler} service.
|
21700
21758
|
*
|
21701
21759
|
* @param {string} name Event name to broadcast.
|
21702
21760
|
* @param {...*} args Optional set of arguments which will be passed onto the event listeners.
|
21703
|
-
* @return {Object} Event object, see {@link ng.$rootScope.Scope
|
21761
|
+
* @return {Object} Event object, see {@link ng.$rootScope.Scope#methods_$on}
|
21704
21762
|
*/
|
21705
21763
|
$broadcast: function(name, args) {
|
21706
21764
|
var target = this,
|
@@ -23320,13 +23378,15 @@ function urlIsSameOrigin(requestUrl) {
|
|
23320
23378
|
<doc:source>
|
23321
23379
|
<script>
|
23322
23380
|
function Ctrl($scope, $window) {
|
23323
|
-
$scope.$window = $window;
|
23324
23381
|
$scope.greeting = 'Hello, World!';
|
23382
|
+
$scope.doGreeting = function(greeting) {
|
23383
|
+
$window.alert(greeting);
|
23384
|
+
};
|
23325
23385
|
}
|
23326
23386
|
</script>
|
23327
23387
|
<div ng-controller="Ctrl">
|
23328
23388
|
<input type="text" ng-model="greeting" />
|
23329
|
-
<button ng-click="
|
23389
|
+
<button ng-click="doGreeting(greeting)">ALERT</button>
|
23330
23390
|
</div>
|
23331
23391
|
</doc:source>
|
23332
23392
|
<doc:scenario>
|
@@ -24435,14 +24495,16 @@ var htmlAnchorDirective = valueFn({
|
|
24435
24495
|
element.append(document.createComment('IE fix'));
|
24436
24496
|
}
|
24437
24497
|
|
24438
|
-
|
24439
|
-
|
24440
|
-
|
24441
|
-
|
24442
|
-
|
24443
|
-
|
24444
|
-
|
24445
|
-
|
24498
|
+
if (!attr.href && !attr.name) {
|
24499
|
+
return function(scope, element) {
|
24500
|
+
element.on('click', function(event){
|
24501
|
+
// if we have no href url, then don't navigate anywhere.
|
24502
|
+
if (!element.attr('href')) {
|
24503
|
+
event.preventDefault();
|
24504
|
+
}
|
24505
|
+
});
|
24506
|
+
};
|
24507
|
+
}
|
24446
24508
|
}
|
24447
24509
|
});
|
24448
24510
|
|
@@ -24833,9 +24895,22 @@ var nullFormCtrl = {
|
|
24833
24895
|
* @property {Object} $error Is an object hash, containing references to all invalid controls or
|
24834
24896
|
* forms, where:
|
24835
24897
|
*
|
24836
|
-
* - keys are validation tokens (error names)
|
24837
|
-
* - values are arrays of controls or forms that are invalid
|
24898
|
+
* - keys are validation tokens (error names),
|
24899
|
+
* - values are arrays of controls or forms that are invalid for given error name.
|
24838
24900
|
*
|
24901
|
+
*
|
24902
|
+
* Built-in validation tokens:
|
24903
|
+
*
|
24904
|
+
* - `email`
|
24905
|
+
* - `max`
|
24906
|
+
* - `maxlength`
|
24907
|
+
* - `min`
|
24908
|
+
* - `minlength`
|
24909
|
+
* - `number`
|
24910
|
+
* - `pattern`
|
24911
|
+
* - `required`
|
24912
|
+
* - `url`
|
24913
|
+
*
|
24839
24914
|
* @description
|
24840
24915
|
* `FormController` keeps track of all its controls and nested forms as well as state of them,
|
24841
24916
|
* such as being valid/invalid or dirty/pristine.
|
@@ -26129,39 +26204,6 @@ var VALID_CLASS = 'ng-valid',
|
|
26129
26204
|
</file>
|
26130
26205
|
* </example>
|
26131
26206
|
*
|
26132
|
-
* ## Isolated Scope Pitfall
|
26133
|
-
*
|
26134
|
-
* Note that if you have a directive with an isolated scope, you cannot require `ngModel`
|
26135
|
-
* since the model value will be looked up on the isolated scope rather than the outer scope.
|
26136
|
-
* When the directive updates the model value, calling `ngModel.$setViewValue()` the property
|
26137
|
-
* on the outer scope will not be updated. However you can get around this by using $parent.
|
26138
|
-
*
|
26139
|
-
* Here is an example of this situation. You'll notice that the first div is not updating the input.
|
26140
|
-
* However the second div can update the input properly.
|
26141
|
-
*
|
26142
|
-
* <example module="badIsolatedDirective">
|
26143
|
-
<file name="script.js">
|
26144
|
-
angular.module('badIsolatedDirective', []).directive('isolate', function() {
|
26145
|
-
return {
|
26146
|
-
require: 'ngModel',
|
26147
|
-
scope: { },
|
26148
|
-
template: '<input ng-model="innerModel">',
|
26149
|
-
link: function(scope, element, attrs, ngModel) {
|
26150
|
-
scope.$watch('innerModel', function(value) {
|
26151
|
-
console.log(value);
|
26152
|
-
ngModel.$setViewValue(value);
|
26153
|
-
});
|
26154
|
-
}
|
26155
|
-
};
|
26156
|
-
});
|
26157
|
-
</file>
|
26158
|
-
<file name="index.html">
|
26159
|
-
<input ng-model="someModel"/>
|
26160
|
-
<div isolate ng-model="someModel"></div>
|
26161
|
-
<div isolate ng-model="$parent.someModel"></div>
|
26162
|
-
</file>
|
26163
|
-
* </example>
|
26164
|
-
*
|
26165
26207
|
*
|
26166
26208
|
*/
|
26167
26209
|
var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse',
|
@@ -26308,7 +26350,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
|
|
26308
26350
|
* It will update the $viewValue, then pass this value through each of the functions in `$parsers`,
|
26309
26351
|
* which includes any validators. The value that comes out of this `$parsers` pipeline, be applied to
|
26310
26352
|
* `$modelValue` and the **expression** specified in the `ng-model` attribute.
|
26311
|
-
*
|
26353
|
+
*
|
26312
26354
|
* Lastly, all the registered change listeners, in the `$viewChangeListeners` list, are called.
|
26313
26355
|
*
|
26314
26356
|
* Note that calling this function does not trigger a `$digest`.
|
@@ -26365,6 +26407,8 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
|
|
26365
26407
|
ctrl.$render();
|
26366
26408
|
}
|
26367
26409
|
}
|
26410
|
+
|
26411
|
+
return value;
|
26368
26412
|
});
|
26369
26413
|
}];
|
26370
26414
|
|
@@ -26641,7 +26685,6 @@ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
|
|
26641
26685
|
id="{{name}}"
|
26642
26686
|
name="favorite">
|
26643
26687
|
</label>
|
26644
|
-
</span>
|
26645
26688
|
<div>You chose {{my.favorite}}</div>
|
26646
26689
|
</form>
|
26647
26690
|
</doc:source>
|
@@ -27858,9 +27901,12 @@ var ngIfDirective = ['$animate', function($animate) {
|
|
27858
27901
|
if (!childScope) {
|
27859
27902
|
childScope = $scope.$new();
|
27860
27903
|
$transclude(childScope, function (clone) {
|
27904
|
+
clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ');
|
27905
|
+
// Note: We only need the first/last node of the cloned nodes.
|
27906
|
+
// However, we need to keep the reference to the jqlite wrapper as it might be changed later
|
27907
|
+
// by a directive with templateUrl when it's template arrives.
|
27861
27908
|
block = {
|
27862
|
-
|
27863
|
-
endNode: clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ')
|
27909
|
+
clone: clone
|
27864
27910
|
};
|
27865
27911
|
$animate.enter(clone, $element.parent(), $element);
|
27866
27912
|
});
|
@@ -27873,7 +27919,7 @@ var ngIfDirective = ['$animate', function($animate) {
|
|
27873
27919
|
}
|
27874
27920
|
|
27875
27921
|
if (block) {
|
27876
|
-
$animate.leave(getBlockElements(block));
|
27922
|
+
$animate.leave(getBlockElements(block.clone));
|
27877
27923
|
block = null;
|
27878
27924
|
}
|
27879
27925
|
}
|
@@ -28029,13 +28075,14 @@ var ngIfDirective = ['$animate', function($animate) {
|
|
28029
28075
|
* @description
|
28030
28076
|
* Emitted every time the ngInclude content is reloaded.
|
28031
28077
|
*/
|
28032
|
-
var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$
|
28033
|
-
function($http, $templateCache, $anchorScroll, $
|
28078
|
+
var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$animate', '$sce',
|
28079
|
+
function($http, $templateCache, $anchorScroll, $animate, $sce) {
|
28034
28080
|
return {
|
28035
28081
|
restrict: 'ECA',
|
28036
28082
|
priority: 400,
|
28037
28083
|
terminal: true,
|
28038
28084
|
transclude: 'element',
|
28085
|
+
controller: angular.noop,
|
28039
28086
|
compile: function(element, attr) {
|
28040
28087
|
var srcExp = attr.ngInclude || attr.src,
|
28041
28088
|
onloadExp = attr.onload || '',
|
@@ -28069,6 +28116,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
|
28069
28116
|
$http.get(src, {cache: $templateCache}).success(function(response) {
|
28070
28117
|
if (thisChangeId !== changeCounter) return;
|
28071
28118
|
var newScope = scope.$new();
|
28119
|
+
ctrl.template = response;
|
28072
28120
|
|
28073
28121
|
// Note: This will also link all children of ng-include that were contained in the original
|
28074
28122
|
// html. If that content contains controllers, ... they could pollute/change the scope.
|
@@ -28076,15 +28124,14 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
|
28076
28124
|
// Note: We can't remove them in the cloneAttchFn of $transclude as that
|
28077
28125
|
// function is called before linking the content, which would apply child
|
28078
28126
|
// directives to non existing elements.
|
28079
|
-
var clone = $transclude(newScope,
|
28080
|
-
|
28127
|
+
var clone = $transclude(newScope, function(clone) {
|
28128
|
+
cleanupLastIncludeContent();
|
28129
|
+
$animate.enter(clone, null, $element, afterAnimation);
|
28130
|
+
});
|
28081
28131
|
|
28082
28132
|
currentScope = newScope;
|
28083
28133
|
currentElement = clone;
|
28084
28134
|
|
28085
|
-
currentElement.html(response);
|
28086
|
-
$animate.enter(currentElement, null, $element, afterAnimation);
|
28087
|
-
$compile(currentElement.contents())(currentScope);
|
28088
28135
|
currentScope.$emit('$includeContentLoaded');
|
28089
28136
|
scope.$eval(onloadExp);
|
28090
28137
|
}).error(function() {
|
@@ -28093,6 +28140,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
|
28093
28140
|
scope.$emit('$includeContentRequested');
|
28094
28141
|
} else {
|
28095
28142
|
cleanupLastIncludeContent();
|
28143
|
+
ctrl.template = null;
|
28096
28144
|
}
|
28097
28145
|
});
|
28098
28146
|
};
|
@@ -28100,6 +28148,24 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
|
28100
28148
|
};
|
28101
28149
|
}];
|
28102
28150
|
|
28151
|
+
// This directive is called during the $transclude call of the first `ngInclude` directive.
|
28152
|
+
// It will replace and compile the content of the element with the loaded template.
|
28153
|
+
// We need this directive so that the element content is already filled when
|
28154
|
+
// the link function of another directive on the same element as ngInclude
|
28155
|
+
// is called.
|
28156
|
+
var ngIncludeFillContentDirective = ['$compile',
|
28157
|
+
function($compile) {
|
28158
|
+
return {
|
28159
|
+
restrict: 'ECA',
|
28160
|
+
priority: -400,
|
28161
|
+
require: 'ngInclude',
|
28162
|
+
link: function(scope, $element, $attr, ctrl) {
|
28163
|
+
$element.html(ctrl.template);
|
28164
|
+
$compile($element.contents())(scope);
|
28165
|
+
}
|
28166
|
+
};
|
28167
|
+
}];
|
28168
|
+
|
28103
28169
|
/**
|
28104
28170
|
* @ngdoc directive
|
28105
28171
|
* @name ng.directive:ngInit
|
@@ -28116,6 +28182,8 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
|
28116
28182
|
* to initialize values on a scope.
|
28117
28183
|
* </div>
|
28118
28184
|
*
|
28185
|
+
* @priority 450
|
28186
|
+
*
|
28119
28187
|
* @element ANY
|
28120
28188
|
* @param {expression} ngInit {@link guide/expression Expression} to eval.
|
28121
28189
|
*
|
@@ -28147,6 +28215,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
|
|
28147
28215
|
</doc:example>
|
28148
28216
|
*/
|
28149
28217
|
var ngInitDirective = ngDirective({
|
28218
|
+
priority: 450,
|
28150
28219
|
compile: function() {
|
28151
28220
|
return {
|
28152
28221
|
pre: function(scope, element, attrs) {
|
@@ -28704,7 +28773,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
|
|
28704
28773
|
} else if (nextBlockMap.hasOwnProperty(trackById)) {
|
28705
28774
|
// restore lastBlockMap
|
28706
28775
|
forEach(nextBlockOrder, function(block) {
|
28707
|
-
if (block && block.
|
28776
|
+
if (block && block.scope) lastBlockMap[block.id] = block;
|
28708
28777
|
});
|
28709
28778
|
// This is a duplicate and we need to throw an error
|
28710
28779
|
throw ngRepeatMinErr('dupes', "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}",
|
@@ -28721,7 +28790,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
|
|
28721
28790
|
// lastBlockMap is our own object so we don't need to use special hasOwnPropertyFn
|
28722
28791
|
if (lastBlockMap.hasOwnProperty(key)) {
|
28723
28792
|
block = lastBlockMap[key];
|
28724
|
-
elementsToRemove = getBlockElements(block);
|
28793
|
+
elementsToRemove = getBlockElements(block.clone);
|
28725
28794
|
$animate.leave(elementsToRemove);
|
28726
28795
|
forEach(elementsToRemove, function(element) { element[NG_REMOVED] = true; });
|
28727
28796
|
block.scope.$destroy();
|
@@ -28733,9 +28802,9 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
|
|
28733
28802
|
key = (collection === collectionKeys) ? index : collectionKeys[index];
|
28734
28803
|
value = collection[key];
|
28735
28804
|
block = nextBlockOrder[index];
|
28736
|
-
if (nextBlockOrder[index - 1]) previousNode = nextBlockOrder[index - 1]
|
28805
|
+
if (nextBlockOrder[index - 1]) previousNode = getBlockEnd(nextBlockOrder[index - 1]);
|
28737
28806
|
|
28738
|
-
if (block.
|
28807
|
+
if (block.scope) {
|
28739
28808
|
// if we have already seen this object, then we need to reuse the
|
28740
28809
|
// associated scope/element
|
28741
28810
|
childScope = block.scope;
|
@@ -28745,11 +28814,11 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
|
|
28745
28814
|
nextNode = nextNode.nextSibling;
|
28746
28815
|
} while(nextNode && nextNode[NG_REMOVED]);
|
28747
28816
|
|
28748
|
-
if (block
|
28817
|
+
if (getBlockStart(block) != nextNode) {
|
28749
28818
|
// existing item which got moved
|
28750
|
-
$animate.move(getBlockElements(block), null, jqLite(previousNode));
|
28819
|
+
$animate.move(getBlockElements(block.clone), null, jqLite(previousNode));
|
28751
28820
|
}
|
28752
|
-
previousNode = block
|
28821
|
+
previousNode = getBlockEnd(block);
|
28753
28822
|
} else {
|
28754
28823
|
// new item which we don't know about
|
28755
28824
|
childScope = $scope.$new();
|
@@ -28765,14 +28834,16 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
|
|
28765
28834
|
childScope.$odd = !(childScope.$even = (index&1) === 0);
|
28766
28835
|
// jshint bitwise: true
|
28767
28836
|
|
28768
|
-
if (!block.
|
28837
|
+
if (!block.scope) {
|
28769
28838
|
$transclude(childScope, function(clone) {
|
28770
28839
|
clone[clone.length++] = document.createComment(' end ngRepeat: ' + expression + ' ');
|
28771
28840
|
$animate.enter(clone, null, jqLite(previousNode));
|
28772
28841
|
previousNode = clone;
|
28773
28842
|
block.scope = childScope;
|
28774
|
-
|
28775
|
-
|
28843
|
+
// Note: We only need the first/last node of the cloned nodes.
|
28844
|
+
// However, we need to keep the reference to the jqlite wrapper as it might be changed later
|
28845
|
+
// by a directive with templateUrl when it's template arrives.
|
28846
|
+
block.clone = clone;
|
28776
28847
|
nextBlockMap[block.id] = block;
|
28777
28848
|
});
|
28778
28849
|
}
|
@@ -28781,6 +28852,14 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
|
|
28781
28852
|
});
|
28782
28853
|
}
|
28783
28854
|
};
|
28855
|
+
|
28856
|
+
function getBlockStart(block) {
|
28857
|
+
return block.clone[0];
|
28858
|
+
}
|
28859
|
+
|
28860
|
+
function getBlockEnd(block) {
|
28861
|
+
return block.clone[block.clone.length - 1];
|
28862
|
+
}
|
28784
28863
|
}];
|
28785
28864
|
|
28786
28865
|
/**
|
@@ -29133,19 +29212,26 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
|
|
29133
29212
|
* @restrict EA
|
29134
29213
|
*
|
29135
29214
|
* @description
|
29136
|
-
* The ngSwitch directive is used to conditionally swap DOM structure on your template based on a scope expression.
|
29137
|
-
* Elements within ngSwitch but without ngSwitchWhen or ngSwitchDefault directives will be preserved at the location
|
29215
|
+
* The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
|
29216
|
+
* Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
|
29138
29217
|
* as specified in the template.
|
29139
29218
|
*
|
29140
29219
|
* The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
|
29141
|
-
* from the template cache), ngSwitch simply choses one of the nested elements and makes it visible based on which element
|
29220
|
+
* from the template cache), `ngSwitch` simply choses one of the nested elements and makes it visible based on which element
|
29142
29221
|
* matches the value obtained from the evaluated expression. In other words, you define a container element
|
29143
|
-
* (where you place the directive), place an expression on the
|
29144
|
-
* (or the
|
29222
|
+
* (where you place the directive), place an expression on the **`on="..."` attribute**
|
29223
|
+
* (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
|
29145
29224
|
* a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
|
29146
29225
|
* expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
|
29147
29226
|
* attribute is displayed.
|
29148
29227
|
*
|
29228
|
+
* <div class="alert alert-info">
|
29229
|
+
* Be aware that the attribute values to match against cannot be expressions. They are interpreted
|
29230
|
+
* as literal string values to match against.
|
29231
|
+
* For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
|
29232
|
+
* value of the expression `$scope.someVal`.
|
29233
|
+
* </div>
|
29234
|
+
|
29149
29235
|
* @animations
|
29150
29236
|
* enter - happens after the ngSwitch contents change and the matched child element is placed inside the container
|
29151
29237
|
* leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM
|
@@ -29157,6 +29243,7 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
|
|
29157
29243
|
* <ANY ng-switch-default>...</ANY>
|
29158
29244
|
* </ANY>
|
29159
29245
|
*
|
29246
|
+
*
|
29160
29247
|
* @scope
|
29161
29248
|
* @priority 800
|
29162
29249
|
* @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.
|
@@ -29374,7 +29461,7 @@ var ngTranscludeDirective = ngDirective({
|
|
29374
29461
|
|
29375
29462
|
link: function($scope, $element, $attrs, controller) {
|
29376
29463
|
controller.$transclude(function(clone) {
|
29377
|
-
$element.
|
29464
|
+
$element.empty();
|
29378
29465
|
$element.append(clone);
|
29379
29466
|
});
|
29380
29467
|
}
|
@@ -29758,13 +29845,13 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
|
|
29758
29845
|
// becomes the compilation root
|
29759
29846
|
nullOption.removeClass('ng-scope');
|
29760
29847
|
|
29761
|
-
// we need to remove it before calling selectElement.
|
29848
|
+
// we need to remove it before calling selectElement.empty() because otherwise IE will
|
29762
29849
|
// remove the label from the element. wtf?
|
29763
29850
|
nullOption.remove();
|
29764
29851
|
}
|
29765
29852
|
|
29766
29853
|
// clear contents, we'll add what's needed based on the model
|
29767
|
-
selectElement.
|
29854
|
+
selectElement.empty();
|
29768
29855
|
|
29769
29856
|
selectElement.on('change', function() {
|
29770
29857
|
scope.$apply(function() {
|