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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.3
2
+ * @license AngularJS v1.2.5
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*
2
- AngularJS v1.2.3
2
+ AngularJS v1.2.5
3
3
  (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  License: MIT
5
5
  */
@@ -10,4 +10,3 @@ a.touches&&a.touches.length?a.touches:[a],b=c[0].clientX,c=c[0].clientY;1>b&&1>c
10
10
  function(a){q=!0;s=a.target?a.target:a.srcElement;3==s.nodeType&&(s=s.parentNode);c.addClass(p);t=Date.now();a=a.touches&&a.touches.length?a.touches:[a];a=a[0].originalEvent||a[0];w=a.clientX;x=a.clientY});c.on("touchmove",function(a){f()});c.on("touchcancel",function(a){f()});c.on("touchend",function(a){var h=Date.now()-t,e=a.changedTouches&&a.changedTouches.length?a.changedTouches:a.touches&&a.touches.length?a.touches:[a],g=e[0].originalEvent||e[0],e=g.clientX,g=g.clientY,p=Math.sqrt(Math.pow(e-
11
11
  w,2)+Math.pow(g-x,2));q&&(750>h&&12>p)&&(k||(b[0].addEventListener("click",n,!0),b[0].addEventListener("touchstart",r,!0),k=[]),m=Date.now(),l(k,e,g),s&&s.blur(),v.isDefined(d.disabled)&&!1!==d.disabled||c.triggerHandler("click",[a]));f()});c.onclick=function(a){};c.on("click",function(b,c){a.$apply(function(){h(a,{$event:c||b})})});c.on("mousedown",function(a){c.addClass(p)});c.on("mousemove mouseup",function(a){c.removeClass(p)})}}]);t("ngSwipeLeft",-1,"swipeleft");t("ngSwipeRight",1,"swiperight")})(window,
12
12
  window.angular);
13
- //# sourceMappingURL=angular-touch.min.js.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.3
2
+ * @license AngularJS v1.2.5
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -68,7 +68,7 @@ function minErr(module) {
68
68
  return match;
69
69
  });
70
70
 
71
- message = message + '\nhttp://errors.angularjs.org/1.2.3/' +
71
+ message = message + '\nhttp://errors.angularjs.org/1.2.5/' +
72
72
  (module ? module + '/' : '') + code;
73
73
  for (i = 2; i < arguments.length; i++) {
74
74
  message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
@@ -472,7 +472,7 @@ function valueFn(value) {return function() {return value;};}
472
472
  * @param {*} value Reference to check.
473
473
  * @returns {boolean} True if `value` is undefined.
474
474
  */
475
- function isUndefined(value){return typeof value == 'undefined';}
475
+ function isUndefined(value){return typeof value === 'undefined';}
476
476
 
477
477
 
478
478
  /**
@@ -486,7 +486,7 @@ function isUndefined(value){return typeof value == 'undefined';}
486
486
  * @param {*} value Reference to check.
487
487
  * @returns {boolean} True if `value` is defined.
488
488
  */
489
- function isDefined(value){return typeof value != 'undefined';}
489
+ function isDefined(value){return typeof value !== 'undefined';}
490
490
 
491
491
 
492
492
  /**
@@ -501,7 +501,7 @@ function isDefined(value){return typeof value != 'undefined';}
501
501
  * @param {*} value Reference to check.
502
502
  * @returns {boolean} True if `value` is an `Object` but not `null`.
503
503
  */
504
- function isObject(value){return value != null && typeof value == 'object';}
504
+ function isObject(value){return value != null && typeof value === 'object';}
505
505
 
506
506
 
507
507
  /**
@@ -515,7 +515,7 @@ function isObject(value){return value != null && typeof value == 'object';}
515
515
  * @param {*} value Reference to check.
516
516
  * @returns {boolean} True if `value` is a `String`.
517
517
  */
518
- function isString(value){return typeof value == 'string';}
518
+ function isString(value){return typeof value === 'string';}
519
519
 
520
520
 
521
521
  /**
@@ -529,7 +529,7 @@ function isString(value){return typeof value == 'string';}
529
529
  * @param {*} value Reference to check.
530
530
  * @returns {boolean} True if `value` is a `Number`.
531
531
  */
532
- function isNumber(value){return typeof value == 'number';}
532
+ function isNumber(value){return typeof value === 'number';}
533
533
 
534
534
 
535
535
  /**
@@ -544,7 +544,7 @@ function isNumber(value){return typeof value == 'number';}
544
544
  * @returns {boolean} True if `value` is a `Date`.
545
545
  */
546
546
  function isDate(value){
547
- return toString.apply(value) == '[object Date]';
547
+ return toString.call(value) === '[object Date]';
548
548
  }
549
549
 
550
550
 
@@ -560,7 +560,7 @@ function isDate(value){
560
560
  * @returns {boolean} True if `value` is an `Array`.
561
561
  */
562
562
  function isArray(value) {
563
- return toString.apply(value) == '[object Array]';
563
+ return toString.call(value) === '[object Array]';
564
564
  }
565
565
 
566
566
 
@@ -575,7 +575,7 @@ function isArray(value) {
575
575
  * @param {*} value Reference to check.
576
576
  * @returns {boolean} True if `value` is a `Function`.
577
577
  */
578
- function isFunction(value){return typeof value == 'function';}
578
+ function isFunction(value){return typeof value === 'function';}
579
579
 
580
580
 
581
581
  /**
@@ -586,7 +586,7 @@ function isFunction(value){return typeof value == 'function';}
586
586
  * @returns {boolean} True if `value` is a `RegExp`.
587
587
  */
588
588
  function isRegExp(value) {
589
- return toString.apply(value) == '[object RegExp]';
589
+ return toString.call(value) === '[object RegExp]';
590
590
  }
591
591
 
592
592
 
@@ -608,12 +608,12 @@ function isScope(obj) {
608
608
 
609
609
 
610
610
  function isFile(obj) {
611
- return toString.apply(obj) === '[object File]';
611
+ return toString.call(obj) === '[object File]';
612
612
  }
613
613
 
614
614
 
615
615
  function isBoolean(value) {
616
- return typeof value == 'boolean';
616
+ return typeof value === 'boolean';
617
617
  }
618
618
 
619
619
 
@@ -644,9 +644,9 @@ var trim = (function() {
644
644
  * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
645
645
  */
646
646
  function isElement(node) {
647
- return node &&
647
+ return !!(node &&
648
648
  (node.nodeName // we are a direct element
649
- || (node.on && node.find)); // we have an on and find method part of jQuery API
649
+ || (node.on && node.find))); // we have an on and find method part of jQuery API
650
650
  }
651
651
 
652
652
  /**
@@ -717,7 +717,7 @@ function includes(array, obj) {
717
717
  function indexOf(array, obj) {
718
718
  if (array.indexOf) return array.indexOf(obj);
719
719
 
720
- for ( var i = 0; i < array.length; i++) {
720
+ for (var i = 0; i < array.length; i++) {
721
721
  if (obj === array[i]) return i;
722
722
  }
723
723
  return -1;
@@ -847,7 +847,7 @@ function shallowCopy(src, dst) {
847
847
 
848
848
  for(var key in src) {
849
849
  // shallowCopy is only ever called by $compile nodeLinkFn, which has control over src
850
- // so we don't need to worry hasOwnProperty here
850
+ // so we don't need to worry about using our custom hasOwnProperty here
851
851
  if (src.hasOwnProperty(key) && key.substr(0, 2) !== '$$') {
852
852
  dst[key] = src[key];
853
853
  }
@@ -1053,7 +1053,7 @@ function startingTag(element) {
1053
1053
  try {
1054
1054
  // turns out IE does not let you set .html() on elements which
1055
1055
  // are not allowed to have children. So we just ignore it.
1056
- element.html('');
1056
+ element.empty();
1057
1057
  } catch(e) {}
1058
1058
  // As Per DOM Standards
1059
1059
  var TEXT_NODE = 3;
@@ -1409,23 +1409,25 @@ function getter(obj, path, bindFnToScope) {
1409
1409
  }
1410
1410
 
1411
1411
  /**
1412
- * Return the siblings between `startNode` and `endNode`, inclusive
1413
- * @param {Object} object with `startNode` and `endNode` properties
1412
+ * Return the DOM siblings between the first and last node in the given array.
1413
+ * @param {Array} array like object
1414
1414
  * @returns jQlite object containing the elements
1415
1415
  */
1416
- function getBlockElements(block) {
1417
- if (block.startNode === block.endNode) {
1418
- return jqLite(block.startNode);
1416
+ function getBlockElements(nodes) {
1417
+ var startNode = nodes[0],
1418
+ endNode = nodes[nodes.length - 1];
1419
+ if (startNode === endNode) {
1420
+ return jqLite(startNode);
1419
1421
  }
1420
1422
 
1421
- var element = block.startNode;
1423
+ var element = startNode;
1422
1424
  var elements = [element];
1423
1425
 
1424
1426
  do {
1425
1427
  element = element.nextSibling;
1426
1428
  if (!element) break;
1427
1429
  elements.push(element);
1428
- } while (element !== block.endNode);
1430
+ } while (element !== endNode);
1429
1431
 
1430
1432
  return jqLite(elements);
1431
1433
  }
@@ -1765,6 +1767,7 @@ function setupModuleLoader(window) {
1765
1767
  ngHideDirective,
1766
1768
  ngIfDirective,
1767
1769
  ngIncludeDirective,
1770
+ ngIncludeFillContentDirective,
1768
1771
  ngInitDirective,
1769
1772
  ngNonBindableDirective,
1770
1773
  ngPluralizeDirective,
@@ -1826,11 +1829,11 @@ function setupModuleLoader(window) {
1826
1829
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
1827
1830
  */
1828
1831
  var version = {
1829
- full: '1.2.3', // all of these placeholder strings will be replaced by grunt's
1832
+ full: '1.2.5', // all of these placeholder strings will be replaced by grunt's
1830
1833
  major: 1, // package task
1831
1834
  minor: 2,
1832
- dot: 3,
1833
- codeName: 'unicorn-zapper'
1835
+ dot: 5,
1836
+ codeName: 'singularity-expansion'
1834
1837
  };
1835
1838
 
1836
1839
 
@@ -1918,6 +1921,9 @@ function publishExternalAPI(angular){
1918
1921
  ngRequired: requiredDirective,
1919
1922
  ngValue: ngValueDirective
1920
1923
  }).
1924
+ directive({
1925
+ ngInclude: ngIncludeFillContentDirective
1926
+ }).
1921
1927
  directive(ngAttributeAliasDirectives).
1922
1928
  directive(ngEventDirectives);
1923
1929
  $provide.provider({
@@ -1995,6 +2001,7 @@ function publishExternalAPI(angular){
1995
2001
  * - [`contents()`](http://api.jquery.com/contents/)
1996
2002
  * - [`css()`](http://api.jquery.com/css/)
1997
2003
  * - [`data()`](http://api.jquery.com/data/)
2004
+ * - [`empty()`](http://api.jquery.com/empty/)
1998
2005
  * - [`eq()`](http://api.jquery.com/eq/)
1999
2006
  * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name
2000
2007
  * - [`hasClass()`](http://api.jquery.com/hasClass/)
@@ -2307,6 +2314,15 @@ function jqLiteInheritedData(element, name, value) {
2307
2314
  }
2308
2315
  }
2309
2316
 
2317
+ function jqLiteEmpty(element) {
2318
+ for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) {
2319
+ jqLiteDealoc(childNodes[i]);
2320
+ }
2321
+ while (element.firstChild) {
2322
+ element.removeChild(element.firstChild);
2323
+ }
2324
+ }
2325
+
2310
2326
  //////////////////////////////////////////
2311
2327
  // Functions which are declared directly.
2312
2328
  //////////////////////////////////////////
@@ -2501,7 +2517,9 @@ forEach({
2501
2517
  jqLiteDealoc(childNodes[i]);
2502
2518
  }
2503
2519
  element.innerHTML = value;
2504
- }
2520
+ },
2521
+
2522
+ empty: jqLiteEmpty
2505
2523
  }, function(fn, name){
2506
2524
  /**
2507
2525
  * Properties: writes return selection, reads return first value
@@ -2511,11 +2529,13 @@ forEach({
2511
2529
 
2512
2530
  // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
2513
2531
  // in a way that survives minification.
2514
- if (((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2) === undefined) {
2532
+ // jqLiteEmpty takes no arguments but is a setter.
2533
+ if (fn !== jqLiteEmpty &&
2534
+ (((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2) === undefined)) {
2515
2535
  if (isObject(arg1)) {
2516
2536
 
2517
2537
  // we are a write, but the object properties are the key/values
2518
- for(i=0; i < this.length; i++) {
2538
+ for (i = 0; i < this.length; i++) {
2519
2539
  if (fn === jqLiteData) {
2520
2540
  // data() takes the whole object in jQuery
2521
2541
  fn(this[i], arg1);
@@ -2540,7 +2560,7 @@ forEach({
2540
2560
  }
2541
2561
  } else {
2542
2562
  // we are a write, so apply to all children
2543
- for(i=0; i < this.length; i++) {
2563
+ for (i = 0; i < this.length; i++) {
2544
2564
  fn(this[i], arg1, arg2);
2545
2565
  }
2546
2566
  // return self for chaining
@@ -2771,7 +2791,11 @@ forEach({
2771
2791
  },
2772
2792
 
2773
2793
  find: function(element, selector) {
2774
- return element.getElementsByTagName(selector);
2794
+ if (element.getElementsByTagName) {
2795
+ return element.getElementsByTagName(selector);
2796
+ } else {
2797
+ return [];
2798
+ }
2775
2799
  },
2776
2800
 
2777
2801
  clone: jqLiteClone,
@@ -2907,6 +2931,28 @@ HashMap.prototype = {
2907
2931
  * $rootScope.$digest();
2908
2932
  * });
2909
2933
  * </pre>
2934
+ *
2935
+ * Sometimes you want to get access to the injector of a currently running Angular app
2936
+ * from outside Angular. Perhaps, you want to inject and compile some markup after the
2937
+ * application has been bootstrapped. You can do this using extra `injector()` added
2938
+ * to JQuery/jqLite elements. See {@link angular.element}.
2939
+ *
2940
+ * *This is fairly rare but could be the case if a third party library is injecting the
2941
+ * markup.*
2942
+ *
2943
+ * In the following example a new block of HTML containing a `ng-controller`
2944
+ * directive is added to the end of the document body by JQuery. We then compile and link
2945
+ * it into the current AngularJS scope.
2946
+ *
2947
+ * <pre>
2948
+ * var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
2949
+ * $(document.body).append($div);
2950
+ *
2951
+ * angular.element(document).injector().invoke(function($compile) {
2952
+ * var scope = angular.element($div).scope();
2953
+ * $compile($div)(scope);
2954
+ * });
2955
+ * </pre>
2910
2956
  */
2911
2957
 
2912
2958
 
@@ -3101,7 +3147,7 @@ function annotate(fn) {
3101
3147
  * // ...
3102
3148
  * }
3103
3149
  * // Define function dependencies
3104
- * MyController.$inject = ['$scope', '$route'];
3150
+ * MyController['$inject'] = ['$scope', '$route'];
3105
3151
  *
3106
3152
  * // Then
3107
3153
  * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
@@ -3627,24 +3673,9 @@ function createInjector(modulesToLoad) {
3627
3673
  fn = fn[length];
3628
3674
  }
3629
3675
 
3630
-
3631
- // Performance optimization: http://jsperf.com/apply-vs-call-vs-invoke
3632
- switch (self ? -1 : args.length) {
3633
- case 0: return fn();
3634
- case 1: return fn(args[0]);
3635
- case 2: return fn(args[0], args[1]);
3636
- case 3: return fn(args[0], args[1], args[2]);
3637
- case 4: return fn(args[0], args[1], args[2], args[3]);
3638
- case 5: return fn(args[0], args[1], args[2], args[3], args[4]);
3639
- case 6: return fn(args[0], args[1], args[2], args[3], args[4], args[5]);
3640
- case 7: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
3641
- case 8: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
3642
- case 9: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
3643
- args[8]);
3644
- case 10: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
3645
- args[8], args[9]);
3646
- default: return fn.apply(self, args);
3647
- }
3676
+ // http://jsperf.com/angularjs-invoke-apply-vs-switch
3677
+ // #5388
3678
+ return fn.apply(self, args);
3648
3679
  }
3649
3680
 
3650
3681
  function instantiate(Type, locals) {
@@ -4803,7 +4834,7 @@ function $TemplateCacheProvider() {
4803
4834
  * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.
4804
4835
  * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
4805
4836
  * * `^` - Locate the required controller by searching the element's parents. Throw an error if not found.
4806
- * * `?^` - Attempt to locate the required controller by searching the element's parentsor pass `null` to the
4837
+ * * `?^` - Attempt to locate the required controller by searching the element's parents or pass `null` to the
4807
4838
  * `link` fn if not found.
4808
4839
  *
4809
4840
  *
@@ -5542,7 +5573,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
5542
5573
  createBoundTranscludeFn(scope, childTranscludeFn || transcludeFn)
5543
5574
  );
5544
5575
  } else {
5545
- nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn);
5576
+ nodeLinkFn(childLinkFn, childScope, node, $rootElement, boundTranscludeFn);
5546
5577
  }
5547
5578
  } else if (childLinkFn) {
5548
5579
  childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn);
@@ -5830,7 +5861,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
5830
5861
  });
5831
5862
  } else {
5832
5863
  $template = jqLite(jqLiteClone(compileNode)).contents();
5833
- $compileNode.html(''); // clear contents
5864
+ $compileNode.empty(); // clear contents
5834
5865
  childTranscludeFn = compile($template, transcludeFn);
5835
5866
  }
5836
5867
  }
@@ -6011,7 +6042,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6011
6042
  optional = (match[2] == '?'),
6012
6043
  mode = match[1], // @, =, or &
6013
6044
  lastValue,
6014
- parentGet, parentSet;
6045
+ parentGet, parentSet, compare;
6015
6046
 
6016
6047
  isolateScope.$$isolateBindings[scopeName] = mode + attrName;
6017
6048
 
@@ -6034,6 +6065,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6034
6065
  return;
6035
6066
  }
6036
6067
  parentGet = $parse(attrs[attrName]);
6068
+ if (parentGet.literal) {
6069
+ compare = equals;
6070
+ } else {
6071
+ compare = function(a,b) { return a === b; };
6072
+ }
6037
6073
  parentSet = parentGet.assign || function() {
6038
6074
  // reset the change, or we will throw this exception on every $digest
6039
6075
  lastValue = isolateScope[scopeName] = parentGet(scope);
@@ -6044,19 +6080,18 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6044
6080
  lastValue = isolateScope[scopeName] = parentGet(scope);
6045
6081
  isolateScope.$watch(function parentValueWatch() {
6046
6082
  var parentValue = parentGet(scope);
6047
-
6048
- if (parentValue !== isolateScope[scopeName]) {
6083
+ if (!compare(parentValue, isolateScope[scopeName])) {
6049
6084
  // we are out of sync and need to copy
6050
- if (parentValue !== lastValue) {
6085
+ if (!compare(parentValue, lastValue)) {
6051
6086
  // parent changed and it has precedence
6052
- lastValue = isolateScope[scopeName] = parentValue;
6087
+ isolateScope[scopeName] = parentValue;
6053
6088
  } else {
6054
6089
  // if the parent can be assigned then do so
6055
- parentSet(scope, parentValue = lastValue = isolateScope[scopeName]);
6090
+ parentSet(scope, parentValue = isolateScope[scopeName]);
6056
6091
  }
6057
6092
  }
6058
- return parentValue;
6059
- });
6093
+ return lastValue = parentValue;
6094
+ }, null, parentGet.literal);
6060
6095
  break;
6061
6096
 
6062
6097
  case '&':
@@ -6258,7 +6293,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
6258
6293
  ? origAsyncDirective.templateUrl($compileNode, tAttrs)
6259
6294
  : origAsyncDirective.templateUrl;
6260
6295
 
6261
- $compileNode.html('');
6296
+ $compileNode.empty();
6262
6297
 
6263
6298
  $http.get($sce.getTrustedResourceUrl(templateUrl), {cache: $templateCache}).
6264
6299
  success(function(content) {
@@ -8048,8 +8083,8 @@ function $InterpolateProvider() {
8048
8083
  *
8049
8084
  <pre>
8050
8085
  var $interpolate = ...; // injected
8051
- var exp = $interpolate('Hello {{name}}!');
8052
- expect(exp({name:'Angular'}).toEqual('Hello Angular!');
8086
+ var exp = $interpolate('Hello {{name | uppercase}}!');
8087
+ expect(exp({name:'Angular'}).toEqual('Hello ANGULAR!');
8053
8088
  </pre>
8054
8089
  *
8055
8090
  *
@@ -9247,23 +9282,24 @@ function ensureSafeMemberName(name, fullExpression) {
9247
9282
 
9248
9283
  function ensureSafeObject(obj, fullExpression) {
9249
9284
  // nifty check if obj is Function that is fast and works across iframes and other contexts
9250
- if (obj && obj.constructor === obj) {
9251
- throw $parseMinErr('isecfn',
9252
- 'Referencing Function in Angular expressions is disallowed! Expression: {0}',
9253
- fullExpression);
9254
- } else if (// isWindow(obj)
9255
- obj && obj.document && obj.location && obj.alert && obj.setInterval) {
9256
- throw $parseMinErr('isecwindow',
9257
- 'Referencing the Window in Angular expressions is disallowed! Expression: {0}',
9258
- fullExpression);
9259
- } else if (// isElement(obj)
9260
- obj && (obj.nodeName || (obj.on && obj.find))) {
9261
- throw $parseMinErr('isecdom',
9262
- 'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',
9263
- fullExpression);
9264
- } else {
9265
- return obj;
9285
+ if (obj) {
9286
+ if (obj.constructor === obj) {
9287
+ throw $parseMinErr('isecfn',
9288
+ 'Referencing Function in Angular expressions is disallowed! Expression: {0}',
9289
+ fullExpression);
9290
+ } else if (// isWindow(obj)
9291
+ obj.document && obj.location && obj.alert && obj.setInterval) {
9292
+ throw $parseMinErr('isecwindow',
9293
+ 'Referencing the Window in Angular expressions is disallowed! Expression: {0}',
9294
+ fullExpression);
9295
+ } else if (// isElement(obj)
9296
+ obj.children && (obj.nodeName || (obj.on && obj.find))) {
9297
+ throw $parseMinErr('isecdom',
9298
+ 'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',
9299
+ fullExpression);
9300
+ }
9266
9301
  }
9302
+ return obj;
9267
9303
  }
9268
9304
 
9269
9305
  var OPERATORS = {
@@ -10572,7 +10608,7 @@ function $ParseProvider() {
10572
10608
  *
10573
10609
  * # Differences between Kris Kowal's Q and $q
10574
10610
  *
10575
- * There are three main differences:
10611
+ * There are two main differences:
10576
10612
  *
10577
10613
  * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
10578
10614
  * mechanism in angular, which means faster propagation of resolution or rejection into your
@@ -11021,6 +11057,7 @@ function qFactory(nextTick, exceptionHandler) {
11021
11057
  function $RootScopeProvider(){
11022
11058
  var TTL = 10;
11023
11059
  var $rootScopeMinErr = minErr('$rootScope');
11060
+ var lastDirtyWatch = null;
11024
11061
 
11025
11062
  this.digestTtl = function(value) {
11026
11063
  if (arguments.length) {
@@ -11105,11 +11142,11 @@ function $RootScopeProvider(){
11105
11142
  * @description
11106
11143
  * Creates a new child {@link ng.$rootScope.Scope scope}.
11107
11144
  *
11108
- * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} and
11109
- * {@link ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the
11110
- * scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.
11145
+ * The parent scope will propagate the {@link ng.$rootScope.Scope#methods_$digest $digest()} and
11146
+ * {@link ng.$rootScope.Scope#methods_$digest $digest()} events. The scope can be removed from the
11147
+ * scope hierarchy using {@link ng.$rootScope.Scope#methods_$destroy $destroy()}.
11111
11148
  *
11112
- * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is
11149
+ * {@link ng.$rootScope.Scope#methods_$destroy $destroy()} must be called on a scope when it is
11113
11150
  * desired for the scope and its child scopes to be permanently detached from the parent and
11114
11151
  * thus stop participating in model change detection and listener notification by invoking.
11115
11152
  *
@@ -11122,7 +11159,7 @@ function $RootScopeProvider(){
11122
11159
  *
11123
11160
  */
11124
11161
  $new: function(isolate) {
11125
- var Child,
11162
+ var ChildScope,
11126
11163
  child;
11127
11164
 
11128
11165
  if (isolate) {
@@ -11132,11 +11169,11 @@ function $RootScopeProvider(){
11132
11169
  child.$$asyncQueue = this.$$asyncQueue;
11133
11170
  child.$$postDigestQueue = this.$$postDigestQueue;
11134
11171
  } else {
11135
- Child = function() {}; // should be anonymous; This is so that when the minifier munges
11172
+ ChildScope = function() {}; // should be anonymous; This is so that when the minifier munges
11136
11173
  // the name it does not become random set of chars. This will then show up as class
11137
11174
  // name in the debugger.
11138
- Child.prototype = this;
11139
- child = new Child();
11175
+ ChildScope.prototype = this;
11176
+ child = new ChildScope();
11140
11177
  child.$id = nextUid();
11141
11178
  }
11142
11179
  child['this'] = child;
@@ -11162,11 +11199,11 @@ function $RootScopeProvider(){
11162
11199
  * @description
11163
11200
  * Registers a `listener` callback to be executed whenever the `watchExpression` changes.
11164
11201
  *
11165
- * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest
11202
+ * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#methods_$digest
11166
11203
  * $digest()} and should return the value that will be watched. (Since
11167
- * {@link ng.$rootScope.Scope#$digest $digest()} reruns when it detects changes the
11204
+ * {@link ng.$rootScope.Scope#methods_$digest $digest()} reruns when it detects changes the
11168
11205
  * `watchExpression` can execute multiple times per
11169
- * {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)
11206
+ * {@link ng.$rootScope.Scope#methods_$digest $digest()} and should be idempotent.)
11170
11207
  * - The `listener` is called only when the value from the current `watchExpression` and the
11171
11208
  * previous call to `watchExpression` are not equal (with the exception of the initial run,
11172
11209
  * see below). The inequality is determined according to
@@ -11178,13 +11215,13 @@ function $RootScopeProvider(){
11178
11215
  * iteration limit is 10 to prevent an infinite loop deadlock.
11179
11216
  *
11180
11217
  *
11181
- * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
11218
+ * If you want to be notified whenever {@link ng.$rootScope.Scope#methods_$digest $digest} is called,
11182
11219
  * you can register a `watchExpression` function with no `listener`. (Since `watchExpression`
11183
- * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a
11220
+ * can execute multiple times per {@link ng.$rootScope.Scope#methods_$digest $digest} cycle when a
11184
11221
  * change is detected, be prepared for multiple calls to your listener.)
11185
11222
  *
11186
11223
  * After a watcher is registered with the scope, the `listener` fn is called asynchronously
11187
- * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
11224
+ * (via {@link ng.$rootScope.Scope#methods_$evalAsync $evalAsync}) to initialize the
11188
11225
  * watcher. In rare cases, this is undesirable because the listener is called when the result
11189
11226
  * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
11190
11227
  * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
@@ -11216,7 +11253,7 @@ function $RootScopeProvider(){
11216
11253
 
11217
11254
 
11218
11255
 
11219
- // Using a listener function
11256
+ // Using a listener function
11220
11257
  var food;
11221
11258
  scope.foodCounter = 0;
11222
11259
  expect(scope.foodCounter).toEqual(0);
@@ -11241,14 +11278,14 @@ function $RootScopeProvider(){
11241
11278
  // Update food and run digest. Now the counter will increment
11242
11279
  food = 'cheeseburger';
11243
11280
  scope.$digest();
11244
- expect(scope.foodCounter).toEqual(1);
11281
+ expect(scope.foodCounter).toEqual(1);
11245
11282
 
11246
11283
  * </pre>
11247
11284
  *
11248
11285
  *
11249
11286
  *
11250
11287
  * @param {(function()|string)} watchExpression Expression that is evaluated on each
11251
- * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers
11288
+ * {@link ng.$rootScope.Scope#methods_$digest $digest} cycle. A change in the return value triggers
11252
11289
  * a call to the `listener`.
11253
11290
  *
11254
11291
  * - `string`: Evaluated as {@link guide/expression expression}
@@ -11275,6 +11312,8 @@ function $RootScopeProvider(){
11275
11312
  eq: !!objectEquality
11276
11313
  };
11277
11314
 
11315
+ lastDirtyWatch = null;
11316
+
11278
11317
  // in the case user pass string, we need to compile it, do we really need this ?
11279
11318
  if (!isFunction(listener)) {
11280
11319
  var listenFn = compileToFn(listener || noop, 'listener');
@@ -11344,7 +11383,7 @@ function $RootScopeProvider(){
11344
11383
  *
11345
11384
  * @param {string|Function(scope)} obj Evaluated as {@link guide/expression expression}. The
11346
11385
  * expression value should evaluate to an object or an array which is observed on each
11347
- * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the
11386
+ * {@link ng.$rootScope.Scope#methods_$digest $digest} cycle. Any shallow change within the
11348
11387
  * collection will trigger a call to the `listener`.
11349
11388
  *
11350
11389
  * @param {function(newCollection, oldCollection, scope)} listener a callback function that is
@@ -11449,9 +11488,9 @@ function $RootScopeProvider(){
11449
11488
  * @function
11450
11489
  *
11451
11490
  * @description
11452
- * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and
11453
- * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change
11454
- * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}
11491
+ * Processes all of the {@link ng.$rootScope.Scope#methods_$watch watchers} of the current scope and
11492
+ * its children. Because a {@link ng.$rootScope.Scope#methods_$watch watcher}'s listener can change
11493
+ * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#methods_$watch watchers}
11455
11494
  * until no more listeners are firing. This means that it is possible to get into an infinite
11456
11495
  * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of
11457
11496
  * iterations exceeds 10.
@@ -11459,12 +11498,12 @@ function $RootScopeProvider(){
11459
11498
  * Usually, you don't call `$digest()` directly in
11460
11499
  * {@link ng.directive:ngController controllers} or in
11461
11500
  * {@link ng.$compileProvider#methods_directive directives}.
11462
- * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within
11501
+ * Instead, you should call {@link ng.$rootScope.Scope#methods_$apply $apply()} (typically from within
11463
11502
  * a {@link ng.$compileProvider#methods_directive directives}), which will force a `$digest()`.
11464
11503
  *
11465
11504
  * If you want to be notified whenever `$digest()` is called,
11466
11505
  * you can register a `watchExpression` function with
11467
- * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.
11506
+ * {@link ng.$rootScope.Scope#methods_$watch $watch()} with no `listener`.
11468
11507
  *
11469
11508
  * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
11470
11509
  *
@@ -11503,6 +11542,8 @@ function $RootScopeProvider(){
11503
11542
 
11504
11543
  beginPhase('$digest');
11505
11544
 
11545
+ lastDirtyWatch = null;
11546
+
11506
11547
  do { // "while dirty" loop
11507
11548
  dirty = false;
11508
11549
  current = target;
@@ -11512,10 +11553,13 @@ function $RootScopeProvider(){
11512
11553
  asyncTask = asyncQueue.shift();
11513
11554
  asyncTask.scope.$eval(asyncTask.expression);
11514
11555
  } catch (e) {
11556
+ clearPhase();
11515
11557
  $exceptionHandler(e);
11516
11558
  }
11559
+ lastDirtyWatch = null;
11517
11560
  }
11518
11561
 
11562
+ traverseScopesLoop:
11519
11563
  do { // "traverse the scopes" loop
11520
11564
  if ((watchers = current.$$watchers)) {
11521
11565
  // process our watches
@@ -11525,25 +11569,34 @@ function $RootScopeProvider(){
11525
11569
  watch = watchers[length];
11526
11570
  // Most common watches are on primitives, in which case we can short
11527
11571
  // circuit it with === operator, only when === fails do we use .equals
11528
- if (watch && (value = watch.get(current)) !== (last = watch.last) &&
11529
- !(watch.eq
11530
- ? equals(value, last)
11531
- : (typeof value == 'number' && typeof last == 'number'
11532
- && isNaN(value) && isNaN(last)))) {
11533
- dirty = true;
11534
- watch.last = watch.eq ? copy(value) : value;
11535
- watch.fn(value, ((last === initWatchVal) ? value : last), current);
11536
- if (ttl < 5) {
11537
- logIdx = 4 - ttl;
11538
- if (!watchLog[logIdx]) watchLog[logIdx] = [];
11539
- logMsg = (isFunction(watch.exp))
11540
- ? 'fn: ' + (watch.exp.name || watch.exp.toString())
11541
- : watch.exp;
11542
- logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last);
11543
- watchLog[logIdx].push(logMsg);
11572
+ if (watch) {
11573
+ if ((value = watch.get(current)) !== (last = watch.last) &&
11574
+ !(watch.eq
11575
+ ? equals(value, last)
11576
+ : (typeof value == 'number' && typeof last == 'number'
11577
+ && isNaN(value) && isNaN(last)))) {
11578
+ dirty = true;
11579
+ lastDirtyWatch = watch;
11580
+ watch.last = watch.eq ? copy(value) : value;
11581
+ watch.fn(value, ((last === initWatchVal) ? value : last), current);
11582
+ if (ttl < 5) {
11583
+ logIdx = 4 - ttl;
11584
+ if (!watchLog[logIdx]) watchLog[logIdx] = [];
11585
+ logMsg = (isFunction(watch.exp))
11586
+ ? 'fn: ' + (watch.exp.name || watch.exp.toString())
11587
+ : watch.exp;
11588
+ logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last);
11589
+ watchLog[logIdx].push(logMsg);
11590
+ }
11591
+ } else if (watch === lastDirtyWatch) {
11592
+ // If the most recently dirty watcher is now clean, short circuit since the remaining watchers
11593
+ // have already been tested.
11594
+ dirty = false;
11595
+ break traverseScopesLoop;
11544
11596
  }
11545
11597
  }
11546
11598
  } catch (e) {
11599
+ clearPhase();
11547
11600
  $exceptionHandler(e);
11548
11601
  }
11549
11602
  }
@@ -11552,13 +11605,16 @@ function $RootScopeProvider(){
11552
11605
  // Insanity Warning: scope depth-first traversal
11553
11606
  // yes, this code is a bit crazy, but it works and we have tests to prove it!
11554
11607
  // this piece should be kept in sync with the traversal in $broadcast
11555
- if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) {
11608
+ if (!(next = (current.$$childHead ||
11609
+ (current !== target && current.$$nextSibling)))) {
11556
11610
  while(current !== target && !(next = current.$$nextSibling)) {
11557
11611
  current = current.$parent;
11558
11612
  }
11559
11613
  }
11560
11614
  } while ((current = next));
11561
11615
 
11616
+ // `break traverseScopesLoop;` takes us to here
11617
+
11562
11618
  if(dirty && !(ttl--)) {
11563
11619
  clearPhase();
11564
11620
  throw $rootScopeMinErr('infdig',
@@ -11566,6 +11622,7 @@ function $RootScopeProvider(){
11566
11622
  'Watchers fired in the last 5 iterations: {1}',
11567
11623
  TTL, toJson(watchLog));
11568
11624
  }
11625
+
11569
11626
  } while (dirty || asyncQueue.length);
11570
11627
 
11571
11628
  clearPhase();
@@ -11601,7 +11658,7 @@ function $RootScopeProvider(){
11601
11658
  *
11602
11659
  * @description
11603
11660
  * Removes the current scope (and all of its children) from the parent scope. Removal implies
11604
- * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer
11661
+ * that calls to {@link ng.$rootScope.Scope#methods_$digest $digest()} will no longer
11605
11662
  * propagate to the current scope and its children. Removal also implies that the current
11606
11663
  * scope is eligible for garbage collection.
11607
11664
  *
@@ -11618,11 +11675,12 @@ function $RootScopeProvider(){
11618
11675
  */
11619
11676
  $destroy: function() {
11620
11677
  // we can't destroy the root scope or a scope that has been already destroyed
11621
- if ($rootScope == this || this.$$destroyed) return;
11678
+ if (this.$$destroyed) return;
11622
11679
  var parent = this.$parent;
11623
11680
 
11624
11681
  this.$broadcast('$destroy');
11625
11682
  this.$$destroyed = true;
11683
+ if (this === $rootScope) return;
11626
11684
 
11627
11685
  if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
11628
11686
  if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
@@ -11660,7 +11718,7 @@ function $RootScopeProvider(){
11660
11718
  *
11661
11719
  * - `string`: execute using the rules as defined in {@link guide/expression expression}.
11662
11720
  * - `function(scope)`: execute the function with the current `scope` parameter.
11663
- *
11721
+ *
11664
11722
  * @param {(object)=} locals Local variables object, useful for overriding values in scope.
11665
11723
  * @returns {*} The result of evaluating the expression.
11666
11724
  */
@@ -11682,7 +11740,7 @@ function $RootScopeProvider(){
11682
11740
  *
11683
11741
  * - it will execute after the function that scheduled the evaluation (preferably before DOM
11684
11742
  * rendering).
11685
- * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after
11743
+ * - at least one {@link ng.$rootScope.Scope#methods_$digest $digest cycle} will be performed after
11686
11744
  * `expression` execution.
11687
11745
  *
11688
11746
  * Any exceptions from the execution of the expression are forwarded to the
@@ -11727,7 +11785,7 @@ function $RootScopeProvider(){
11727
11785
  * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).
11728
11786
  * Because we are calling into the angular framework we need to perform proper scope life
11729
11787
  * cycle of {@link ng.$exceptionHandler exception handling},
11730
- * {@link ng.$rootScope.Scope#$digest executing watches}.
11788
+ * {@link ng.$rootScope.Scope#methods_$digest executing watches}.
11731
11789
  *
11732
11790
  * ## Life cycle
11733
11791
  *
@@ -11748,11 +11806,11 @@ function $RootScopeProvider(){
11748
11806
  * Scope's `$apply()` method transitions through the following stages:
11749
11807
  *
11750
11808
  * 1. The {@link guide/expression expression} is executed using the
11751
- * {@link ng.$rootScope.Scope#$eval $eval()} method.
11809
+ * {@link ng.$rootScope.Scope#methods_$eval $eval()} method.
11752
11810
  * 2. Any exceptions from the execution of the expression are forwarded to the
11753
11811
  * {@link ng.$exceptionHandler $exceptionHandler} service.
11754
- * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the
11755
- * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
11812
+ * 3. The {@link ng.$rootScope.Scope#methods_$watch watch} listeners are fired immediately after the
11813
+ * expression was executed using the {@link ng.$rootScope.Scope#methods_$digest $digest()} method.
11756
11814
  *
11757
11815
  *
11758
11816
  * @param {(string|function())=} exp An angular expression to be executed.
@@ -11786,7 +11844,7 @@ function $RootScopeProvider(){
11786
11844
  * @function
11787
11845
  *
11788
11846
  * @description
11789
- * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for
11847
+ * Listens on events of a given type. See {@link ng.$rootScope.Scope#methods_$emit $emit} for
11790
11848
  * discussion of event life cycle.
11791
11849
  *
11792
11850
  * The event listener function format is: `function(event, args...)`. The `event` object
@@ -11827,20 +11885,20 @@ function $RootScopeProvider(){
11827
11885
  *
11828
11886
  * @description
11829
11887
  * Dispatches an event `name` upwards through the scope hierarchy notifying the
11830
- * registered {@link ng.$rootScope.Scope#$on} listeners.
11888
+ * registered {@link ng.$rootScope.Scope#methods_$on} listeners.
11831
11889
  *
11832
11890
  * The event life cycle starts at the scope on which `$emit` was called. All
11833
- * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
11891
+ * {@link ng.$rootScope.Scope#methods_$on listeners} listening for `name` event on this scope get
11834
11892
  * notified. Afterwards, the event traverses upwards toward the root scope and calls all
11835
11893
  * registered listeners along the way. The event will stop propagating if one of the listeners
11836
11894
  * cancels it.
11837
11895
  *
11838
- * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
11896
+ * Any exception emitted from the {@link ng.$rootScope.Scope#methods_$on listeners} will be passed
11839
11897
  * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
11840
11898
  *
11841
11899
  * @param {string} name Event name to emit.
11842
11900
  * @param {...*} args Optional set of arguments which will be passed onto the event listeners.
11843
- * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).
11901
+ * @return {Object} Event object (see {@link ng.$rootScope.Scope#methods_$on}).
11844
11902
  */
11845
11903
  $emit: function(name, args) {
11846
11904
  var empty = [],
@@ -11896,19 +11954,19 @@ function $RootScopeProvider(){
11896
11954
  *
11897
11955
  * @description
11898
11956
  * Dispatches an event `name` downwards to all child scopes (and their children) notifying the
11899
- * registered {@link ng.$rootScope.Scope#$on} listeners.
11957
+ * registered {@link ng.$rootScope.Scope#methods_$on} listeners.
11900
11958
  *
11901
11959
  * The event life cycle starts at the scope on which `$broadcast` was called. All
11902
- * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
11960
+ * {@link ng.$rootScope.Scope#methods_$on listeners} listening for `name` event on this scope get
11903
11961
  * notified. Afterwards, the event propagates to all direct and indirect scopes of the current
11904
11962
  * scope and calls all registered listeners along the way. The event cannot be canceled.
11905
11963
  *
11906
- * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
11964
+ * Any exception emitted from the {@link ng.$rootScope.Scope#methods_$on listeners} will be passed
11907
11965
  * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
11908
11966
  *
11909
11967
  * @param {string} name Event name to broadcast.
11910
11968
  * @param {...*} args Optional set of arguments which will be passed onto the event listeners.
11911
- * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
11969
+ * @return {Object} Event object, see {@link ng.$rootScope.Scope#methods_$on}
11912
11970
  */
11913
11971
  $broadcast: function(name, args) {
11914
11972
  var target = this,
@@ -13528,13 +13586,15 @@ function urlIsSameOrigin(requestUrl) {
13528
13586
  <doc:source>
13529
13587
  <script>
13530
13588
  function Ctrl($scope, $window) {
13531
- $scope.$window = $window;
13532
13589
  $scope.greeting = 'Hello, World!';
13590
+ $scope.doGreeting = function(greeting) {
13591
+ $window.alert(greeting);
13592
+ };
13533
13593
  }
13534
13594
  </script>
13535
13595
  <div ng-controller="Ctrl">
13536
13596
  <input type="text" ng-model="greeting" />
13537
- <button ng-click="$window.alert(greeting)">ALERT</button>
13597
+ <button ng-click="doGreeting(greeting)">ALERT</button>
13538
13598
  </div>
13539
13599
  </doc:source>
13540
13600
  <doc:scenario>
@@ -14643,14 +14703,16 @@ var htmlAnchorDirective = valueFn({
14643
14703
  element.append(document.createComment('IE fix'));
14644
14704
  }
14645
14705
 
14646
- return function(scope, element) {
14647
- element.on('click', function(event){
14648
- // if we have no href url, then don't navigate anywhere.
14649
- if (!element.attr('href')) {
14650
- event.preventDefault();
14651
- }
14652
- });
14653
- };
14706
+ if (!attr.href && !attr.name) {
14707
+ return function(scope, element) {
14708
+ element.on('click', function(event){
14709
+ // if we have no href url, then don't navigate anywhere.
14710
+ if (!element.attr('href')) {
14711
+ event.preventDefault();
14712
+ }
14713
+ });
14714
+ };
14715
+ }
14654
14716
  }
14655
14717
  });
14656
14718
 
@@ -15041,9 +15103,22 @@ var nullFormCtrl = {
15041
15103
  * @property {Object} $error Is an object hash, containing references to all invalid controls or
15042
15104
  * forms, where:
15043
15105
  *
15044
- * - keys are validation tokens (error names) — such as `required`, `url` or `email`,
15045
- * - values are arrays of controls or forms that are invalid with given error.
15106
+ * - keys are validation tokens (error names),
15107
+ * - values are arrays of controls or forms that are invalid for given error name.
15108
+ *
15109
+ *
15110
+ * Built-in validation tokens:
15046
15111
  *
15112
+ * - `email`
15113
+ * - `max`
15114
+ * - `maxlength`
15115
+ * - `min`
15116
+ * - `minlength`
15117
+ * - `number`
15118
+ * - `pattern`
15119
+ * - `required`
15120
+ * - `url`
15121
+ *
15047
15122
  * @description
15048
15123
  * `FormController` keeps track of all its controls and nested forms as well as state of them,
15049
15124
  * such as being valid/invalid or dirty/pristine.
@@ -16337,39 +16412,6 @@ var VALID_CLASS = 'ng-valid',
16337
16412
  </file>
16338
16413
  * </example>
16339
16414
  *
16340
- * ## Isolated Scope Pitfall
16341
- *
16342
- * Note that if you have a directive with an isolated scope, you cannot require `ngModel`
16343
- * since the model value will be looked up on the isolated scope rather than the outer scope.
16344
- * When the directive updates the model value, calling `ngModel.$setViewValue()` the property
16345
- * on the outer scope will not be updated. However you can get around this by using $parent.
16346
- *
16347
- * Here is an example of this situation. You'll notice that the first div is not updating the input.
16348
- * However the second div can update the input properly.
16349
- *
16350
- * <example module="badIsolatedDirective">
16351
- <file name="script.js">
16352
- angular.module('badIsolatedDirective', []).directive('isolate', function() {
16353
- return {
16354
- require: 'ngModel',
16355
- scope: { },
16356
- template: '<input ng-model="innerModel">',
16357
- link: function(scope, element, attrs, ngModel) {
16358
- scope.$watch('innerModel', function(value) {
16359
- console.log(value);
16360
- ngModel.$setViewValue(value);
16361
- });
16362
- }
16363
- };
16364
- });
16365
- </file>
16366
- <file name="index.html">
16367
- <input ng-model="someModel"/>
16368
- <div isolate ng-model="someModel"></div>
16369
- <div isolate ng-model="$parent.someModel"></div>
16370
- </file>
16371
- * </example>
16372
- *
16373
16415
  *
16374
16416
  */
16375
16417
  var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse',
@@ -16516,7 +16558,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
16516
16558
  * It will update the $viewValue, then pass this value through each of the functions in `$parsers`,
16517
16559
  * which includes any validators. The value that comes out of this `$parsers` pipeline, be applied to
16518
16560
  * `$modelValue` and the **expression** specified in the `ng-model` attribute.
16519
- *
16561
+ *
16520
16562
  * Lastly, all the registered change listeners, in the `$viewChangeListeners` list, are called.
16521
16563
  *
16522
16564
  * Note that calling this function does not trigger a `$digest`.
@@ -16573,6 +16615,8 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
16573
16615
  ctrl.$render();
16574
16616
  }
16575
16617
  }
16618
+
16619
+ return value;
16576
16620
  });
16577
16621
  }];
16578
16622
 
@@ -16849,7 +16893,6 @@ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
16849
16893
  id="{{name}}"
16850
16894
  name="favorite">
16851
16895
  </label>
16852
- </span>
16853
16896
  <div>You chose {{my.favorite}}</div>
16854
16897
  </form>
16855
16898
  </doc:source>
@@ -18066,9 +18109,12 @@ var ngIfDirective = ['$animate', function($animate) {
18066
18109
  if (!childScope) {
18067
18110
  childScope = $scope.$new();
18068
18111
  $transclude(childScope, function (clone) {
18112
+ clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ');
18113
+ // Note: We only need the first/last node of the cloned nodes.
18114
+ // However, we need to keep the reference to the jqlite wrapper as it might be changed later
18115
+ // by a directive with templateUrl when it's template arrives.
18069
18116
  block = {
18070
- startNode: clone[0],
18071
- endNode: clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ')
18117
+ clone: clone
18072
18118
  };
18073
18119
  $animate.enter(clone, $element.parent(), $element);
18074
18120
  });
@@ -18081,7 +18127,7 @@ var ngIfDirective = ['$animate', function($animate) {
18081
18127
  }
18082
18128
 
18083
18129
  if (block) {
18084
- $animate.leave(getBlockElements(block));
18130
+ $animate.leave(getBlockElements(block.clone));
18085
18131
  block = null;
18086
18132
  }
18087
18133
  }
@@ -18237,13 +18283,14 @@ var ngIfDirective = ['$animate', function($animate) {
18237
18283
  * @description
18238
18284
  * Emitted every time the ngInclude content is reloaded.
18239
18285
  */
18240
- var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile', '$animate', '$sce',
18241
- function($http, $templateCache, $anchorScroll, $compile, $animate, $sce) {
18286
+ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$animate', '$sce',
18287
+ function($http, $templateCache, $anchorScroll, $animate, $sce) {
18242
18288
  return {
18243
18289
  restrict: 'ECA',
18244
18290
  priority: 400,
18245
18291
  terminal: true,
18246
18292
  transclude: 'element',
18293
+ controller: angular.noop,
18247
18294
  compile: function(element, attr) {
18248
18295
  var srcExp = attr.ngInclude || attr.src,
18249
18296
  onloadExp = attr.onload || '',
@@ -18277,6 +18324,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
18277
18324
  $http.get(src, {cache: $templateCache}).success(function(response) {
18278
18325
  if (thisChangeId !== changeCounter) return;
18279
18326
  var newScope = scope.$new();
18327
+ ctrl.template = response;
18280
18328
 
18281
18329
  // Note: This will also link all children of ng-include that were contained in the original
18282
18330
  // html. If that content contains controllers, ... they could pollute/change the scope.
@@ -18284,15 +18332,14 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
18284
18332
  // Note: We can't remove them in the cloneAttchFn of $transclude as that
18285
18333
  // function is called before linking the content, which would apply child
18286
18334
  // directives to non existing elements.
18287
- var clone = $transclude(newScope, noop);
18288
- cleanupLastIncludeContent();
18335
+ var clone = $transclude(newScope, function(clone) {
18336
+ cleanupLastIncludeContent();
18337
+ $animate.enter(clone, null, $element, afterAnimation);
18338
+ });
18289
18339
 
18290
18340
  currentScope = newScope;
18291
18341
  currentElement = clone;
18292
18342
 
18293
- currentElement.html(response);
18294
- $animate.enter(currentElement, null, $element, afterAnimation);
18295
- $compile(currentElement.contents())(currentScope);
18296
18343
  currentScope.$emit('$includeContentLoaded');
18297
18344
  scope.$eval(onloadExp);
18298
18345
  }).error(function() {
@@ -18301,6 +18348,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
18301
18348
  scope.$emit('$includeContentRequested');
18302
18349
  } else {
18303
18350
  cleanupLastIncludeContent();
18351
+ ctrl.template = null;
18304
18352
  }
18305
18353
  });
18306
18354
  };
@@ -18308,6 +18356,24 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
18308
18356
  };
18309
18357
  }];
18310
18358
 
18359
+ // This directive is called during the $transclude call of the first `ngInclude` directive.
18360
+ // It will replace and compile the content of the element with the loaded template.
18361
+ // We need this directive so that the element content is already filled when
18362
+ // the link function of another directive on the same element as ngInclude
18363
+ // is called.
18364
+ var ngIncludeFillContentDirective = ['$compile',
18365
+ function($compile) {
18366
+ return {
18367
+ restrict: 'ECA',
18368
+ priority: -400,
18369
+ require: 'ngInclude',
18370
+ link: function(scope, $element, $attr, ctrl) {
18371
+ $element.html(ctrl.template);
18372
+ $compile($element.contents())(scope);
18373
+ }
18374
+ };
18375
+ }];
18376
+
18311
18377
  /**
18312
18378
  * @ngdoc directive
18313
18379
  * @name ng.directive:ngInit
@@ -18324,6 +18390,8 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
18324
18390
  * to initialize values on a scope.
18325
18391
  * </div>
18326
18392
  *
18393
+ * @priority 450
18394
+ *
18327
18395
  * @element ANY
18328
18396
  * @param {expression} ngInit {@link guide/expression Expression} to eval.
18329
18397
  *
@@ -18355,6 +18423,7 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
18355
18423
  </doc:example>
18356
18424
  */
18357
18425
  var ngInitDirective = ngDirective({
18426
+ priority: 450,
18358
18427
  compile: function() {
18359
18428
  return {
18360
18429
  pre: function(scope, element, attrs) {
@@ -18912,7 +18981,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
18912
18981
  } else if (nextBlockMap.hasOwnProperty(trackById)) {
18913
18982
  // restore lastBlockMap
18914
18983
  forEach(nextBlockOrder, function(block) {
18915
- if (block && block.startNode) lastBlockMap[block.id] = block;
18984
+ if (block && block.scope) lastBlockMap[block.id] = block;
18916
18985
  });
18917
18986
  // This is a duplicate and we need to throw an error
18918
18987
  throw ngRepeatMinErr('dupes', "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}",
@@ -18929,7 +18998,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
18929
18998
  // lastBlockMap is our own object so we don't need to use special hasOwnPropertyFn
18930
18999
  if (lastBlockMap.hasOwnProperty(key)) {
18931
19000
  block = lastBlockMap[key];
18932
- elementsToRemove = getBlockElements(block);
19001
+ elementsToRemove = getBlockElements(block.clone);
18933
19002
  $animate.leave(elementsToRemove);
18934
19003
  forEach(elementsToRemove, function(element) { element[NG_REMOVED] = true; });
18935
19004
  block.scope.$destroy();
@@ -18941,9 +19010,9 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
18941
19010
  key = (collection === collectionKeys) ? index : collectionKeys[index];
18942
19011
  value = collection[key];
18943
19012
  block = nextBlockOrder[index];
18944
- if (nextBlockOrder[index - 1]) previousNode = nextBlockOrder[index - 1].endNode;
19013
+ if (nextBlockOrder[index - 1]) previousNode = getBlockEnd(nextBlockOrder[index - 1]);
18945
19014
 
18946
- if (block.startNode) {
19015
+ if (block.scope) {
18947
19016
  // if we have already seen this object, then we need to reuse the
18948
19017
  // associated scope/element
18949
19018
  childScope = block.scope;
@@ -18953,11 +19022,11 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
18953
19022
  nextNode = nextNode.nextSibling;
18954
19023
  } while(nextNode && nextNode[NG_REMOVED]);
18955
19024
 
18956
- if (block.startNode != nextNode) {
19025
+ if (getBlockStart(block) != nextNode) {
18957
19026
  // existing item which got moved
18958
- $animate.move(getBlockElements(block), null, jqLite(previousNode));
19027
+ $animate.move(getBlockElements(block.clone), null, jqLite(previousNode));
18959
19028
  }
18960
- previousNode = block.endNode;
19029
+ previousNode = getBlockEnd(block);
18961
19030
  } else {
18962
19031
  // new item which we don't know about
18963
19032
  childScope = $scope.$new();
@@ -18973,14 +19042,16 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
18973
19042
  childScope.$odd = !(childScope.$even = (index&1) === 0);
18974
19043
  // jshint bitwise: true
18975
19044
 
18976
- if (!block.startNode) {
19045
+ if (!block.scope) {
18977
19046
  $transclude(childScope, function(clone) {
18978
19047
  clone[clone.length++] = document.createComment(' end ngRepeat: ' + expression + ' ');
18979
19048
  $animate.enter(clone, null, jqLite(previousNode));
18980
19049
  previousNode = clone;
18981
19050
  block.scope = childScope;
18982
- block.startNode = previousNode && previousNode.endNode ? previousNode.endNode : clone[0];
18983
- block.endNode = clone[clone.length - 1];
19051
+ // Note: We only need the first/last node of the cloned nodes.
19052
+ // However, we need to keep the reference to the jqlite wrapper as it might be changed later
19053
+ // by a directive with templateUrl when it's template arrives.
19054
+ block.clone = clone;
18984
19055
  nextBlockMap[block.id] = block;
18985
19056
  });
18986
19057
  }
@@ -18989,6 +19060,14 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
18989
19060
  });
18990
19061
  }
18991
19062
  };
19063
+
19064
+ function getBlockStart(block) {
19065
+ return block.clone[0];
19066
+ }
19067
+
19068
+ function getBlockEnd(block) {
19069
+ return block.clone[block.clone.length - 1];
19070
+ }
18992
19071
  }];
18993
19072
 
18994
19073
  /**
@@ -19341,19 +19420,26 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
19341
19420
  * @restrict EA
19342
19421
  *
19343
19422
  * @description
19344
- * The ngSwitch directive is used to conditionally swap DOM structure on your template based on a scope expression.
19345
- * Elements within ngSwitch but without ngSwitchWhen or ngSwitchDefault directives will be preserved at the location
19423
+ * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
19424
+ * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
19346
19425
  * as specified in the template.
19347
19426
  *
19348
19427
  * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
19349
- * from the template cache), ngSwitch simply choses one of the nested elements and makes it visible based on which element
19428
+ * from the template cache), `ngSwitch` simply choses one of the nested elements and makes it visible based on which element
19350
19429
  * matches the value obtained from the evaluated expression. In other words, you define a container element
19351
- * (where you place the directive), place an expression on the **on="..." attribute**
19352
- * (or the **ng-switch="..." attribute**), define any inner elements inside of the directive and place
19430
+ * (where you place the directive), place an expression on the **`on="..."` attribute**
19431
+ * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
19353
19432
  * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
19354
19433
  * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
19355
19434
  * attribute is displayed.
19356
19435
  *
19436
+ * <div class="alert alert-info">
19437
+ * Be aware that the attribute values to match against cannot be expressions. They are interpreted
19438
+ * as literal string values to match against.
19439
+ * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
19440
+ * value of the expression `$scope.someVal`.
19441
+ * </div>
19442
+
19357
19443
  * @animations
19358
19444
  * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container
19359
19445
  * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM
@@ -19365,6 +19451,7 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
19365
19451
  * <ANY ng-switch-default>...</ANY>
19366
19452
  * </ANY>
19367
19453
  *
19454
+ *
19368
19455
  * @scope
19369
19456
  * @priority 800
19370
19457
  * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.
@@ -19582,7 +19669,7 @@ var ngTranscludeDirective = ngDirective({
19582
19669
 
19583
19670
  link: function($scope, $element, $attrs, controller) {
19584
19671
  controller.$transclude(function(clone) {
19585
- $element.html('');
19672
+ $element.empty();
19586
19673
  $element.append(clone);
19587
19674
  });
19588
19675
  }
@@ -19966,13 +20053,13 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
19966
20053
  // becomes the compilation root
19967
20054
  nullOption.removeClass('ng-scope');
19968
20055
 
19969
- // we need to remove it before calling selectElement.html('') because otherwise IE will
20056
+ // we need to remove it before calling selectElement.empty() because otherwise IE will
19970
20057
  // remove the label from the element. wtf?
19971
20058
  nullOption.remove();
19972
20059
  }
19973
20060
 
19974
20061
  // clear contents, we'll add what's needed based on the model
19975
- selectElement.html('');
20062
+ selectElement.empty();
19976
20063
 
19977
20064
  selectElement.on('change', function() {
19978
20065
  scope.$apply(function() {