diff --git a/bower.json b/bower.json index 00dbaa919cf..2bf010192f6 100644 --- a/bower.json +++ b/bower.json @@ -48,9 +48,9 @@ "js/ionic.js" ], "dependencies": { - "angular": "~1.2.12", - "angular-animate": "~1.2.12", - "angular-sanitize": "~1.2.12", + "angular": "~1.2.17", + "angular-animate": "~1.2.17", + "angular-sanitize": "~1.2.17", "angular-ui-router": "0.2.10" } } diff --git a/config/lib/js/angular/angular-animate.js b/config/lib/js/angular/angular-animate.js index 38af3f0f908..865174d3637 100644 --- a/config/lib/js/angular/angular-animate.js +++ b/config/lib/js/angular/angular-animate.js @@ -1,5 +1,5 @@ /** - * @license AngularJS v1.2.12 + * @license AngularJS v1.2.17 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ @@ -8,7 +8,7 @@ /* jshint maxlen: false */ /** - * @ngdoc overview + * @ngdoc module * @name ngAnimate * @description * @@ -16,7 +16,6 @@ * * The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives. * - * {@installModule animate} * *
* @@ -38,12 +37,14 @@ * | {@link ng.directive:ngIf#usage_animations ngIf} | enter and leave | * | {@link ng.directive:ngClass#usage_animations ngClass} | add and remove | * | {@link ng.directive:ngShow#usage_animations ngShow & ngHide} | add and remove (the ng-hide class value) | + * | {@link ng.directive:form#usage_animations form} | add and remove (dirty, pristine, valid, invalid & all other validations) | + * | {@link ng.directive:ngModel#usage_animations ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) | * * You can find out more information about animations upon visiting each directive page. * * Below is an example of how to apply animations to a directive that supports animation hooks: * - *
+ * ```html
  * 
+       
userType: Required!
userType = {{userType}}
@@ -25375,8 +26020,8 @@ function FormController(element, attrs) { myForm.$valid = {{myForm.$valid}}
myForm.$error.required = {{!!myForm.$error.required}}
- - + + it('should initialize to model', function() { var userType = element(by.binding('userType')); var valid = element(by.binding('myForm.input.$valid')); @@ -25396,8 +26041,9 @@ function FormController(element, attrs) { expect(userType.getText()).toEqual('userType ='); expect(valid.getText()).toContain('false'); }); - - + + + * */ var formDirectiveFactory = function(isNgForm) { return ['$timeout', function($timeout) { @@ -25474,8 +26120,8 @@ var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/; var inputType = { /** - * @ngdoc inputType - * @name ng.directive:input.text + * @ngdoc input + * @name input[text] * * @description * Standard HTML text input with angular data binding. @@ -25498,8 +26144,8 @@ var inputType = { * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input. * * @example - - + + + + Update input to see transitions when valid/invalid. + Integer is a valid value. +
+ +
+
+ *
*/ var ngModelDirective = function() { return { @@ -26705,7 +27454,7 @@ var ngModelDirective = function() { /** * @ngdoc directive - * @name ng.directive:ngChange + * @name ngChange * * @description * Evaluate the given expression when the user changes the input. @@ -26721,8 +27470,8 @@ var ngModelDirective = function() { * in input value. * * @example - * - * + * + * * -
- Name: - [ greet ]
- Contact: -
    -
  • - - - [ clear - | X ] -
  • -
  • [ add ]
  • -
-
-
- - it('should check controller as', function() { - var container = element(by.id('ctrl-as-exmpl')); - - expect(container.findElement(by.model('settings.name')) - .getAttribute('value')).toBe('John Smith'); - - var firstRepeat = - container.findElement(by.repeater('contact in settings.contacts').row(0)); - var secondRepeat = - container.findElement(by.repeater('contact in settings.contacts').row(1)); - - expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe('408 555 1212'); - expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe('john.smith@example.org'); - - firstRepeat.findElement(by.linkText('clear')).click() - - expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe(''); - - container.findElement(by.linkText('add')).click(); - - expect(container.findElement(by.repeater('contact in settings.contacts').row(2)) - .findElement(by.model('contact.value')) - .getAttribute('value')) - .toBe('yourname@example.org'); - }); - -
- - - -
- Name: - [ greet ]
- Contact: -
    -
  • - - - [ clear - | X ] -
  • -
  • [ add ]
  • -
-
-
- - it('should check controller', function() { - var container = element(by.id('ctrl-exmpl')); - - expect(container.findElement(by.model('name')) - .getAttribute('value')).toBe('John Smith'); - - var firstRepeat = - container.findElement(by.repeater('contact in contacts').row(0)); - var secondRepeat = - container.findElement(by.repeater('contact in contacts').row(1)); - - expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe('408 555 1212'); - expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe('john.smith@example.org'); - - firstRepeat.findElement(by.linkText('clear')).click() - - expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe(''); - - container.findElement(by.linkText('add')).click(); - - expect(container.findElement(by.repeater('contact in contacts').row(2)) - .findElement(by.model('contact.value')) - .getAttribute('value')) - .toBe('yourname@example.org'); - }); - -
+ * easily be called from the angular markup. Any changes to the data are automatically reflected + * in the View without the need for a manual update. + * + * Two different declaration styles are included below: + * + * * one binds methods and properties directly onto the controller using `this`: + * `ng-controller="SettingsController1 as settings"` + * * one injects `$scope` into the controller: + * `ng-controller="SettingsController2"` + * + * The second option is more common in the Angular community, and is generally used in boilerplates + * and in this guide. However, there are advantages to binding properties directly to the controller + * and avoiding scope. + * + * * Using `controller as` makes it obvious which controller you are accessing in the template when + * multiple controllers apply to an element. + * * If you are writing your controllers as classes you have easier access to the properties and + * methods, which will appear on the scope, from inside the controller code. + * * Since there is always a `.` in the bindings, you don't have to worry about prototypal + * inheritance masking primitives. + * + * This example demonstrates the `controller as` syntax. + * + * + * + *
+ * Name: + * [ greet ]
+ * Contact: + *
    + *
  • + * + * + * [ clear + * | X ] + *
  • + *
  • [ add ]
  • + *
+ *
+ *
+ * + * function SettingsController1() { + * this.name = "John Smith"; + * this.contacts = [ + * {type: 'phone', value: '408 555 1212'}, + * {type: 'email', value: 'john.smith@example.org'} ]; + * } + * + * SettingsController1.prototype.greet = function() { + * alert(this.name); + * }; + * + * SettingsController1.prototype.addContact = function() { + * this.contacts.push({type: 'email', value: 'yourname@example.org'}); + * }; + * + * SettingsController1.prototype.removeContact = function(contactToRemove) { + * var index = this.contacts.indexOf(contactToRemove); + * this.contacts.splice(index, 1); + * }; + * + * SettingsController1.prototype.clearContact = function(contact) { + * contact.type = 'phone'; + * contact.value = ''; + * }; + * + * + * it('should check controller as', function() { + * var container = element(by.id('ctrl-as-exmpl')); + * expect(container.findElement(by.model('settings.name')) + * .getAttribute('value')).toBe('John Smith'); + * + * var firstRepeat = + * container.findElement(by.repeater('contact in settings.contacts').row(0)); + * var secondRepeat = + * container.findElement(by.repeater('contact in settings.contacts').row(1)); + * + * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe('408 555 1212'); + * + * expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe('john.smith@example.org'); + * + * firstRepeat.findElement(by.linkText('clear')).click(); + * + * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe(''); + * + * container.findElement(by.linkText('add')).click(); + * + * expect(container.findElement(by.repeater('contact in settings.contacts').row(2)) + * .findElement(by.model('contact.value')) + * .getAttribute('value')) + * .toBe('yourname@example.org'); + * }); + * + *
+ * + * This example demonstrates the "attach to `$scope`" style of controller. + * + * + * + *
+ * Name: + * [ greet ]
+ * Contact: + *
    + *
  • + * + * + * [ clear + * | X ] + *
  • + *
  • [ add ]
  • + *
+ *
+ *
+ * + * function SettingsController2($scope) { + * $scope.name = "John Smith"; + * $scope.contacts = [ + * {type:'phone', value:'408 555 1212'}, + * {type:'email', value:'john.smith@example.org'} ]; + * + * $scope.greet = function() { + * alert($scope.name); + * }; + * + * $scope.addContact = function() { + * $scope.contacts.push({type:'email', value:'yourname@example.org'}); + * }; + * + * $scope.removeContact = function(contactToRemove) { + * var index = $scope.contacts.indexOf(contactToRemove); + * $scope.contacts.splice(index, 1); + * }; + * + * $scope.clearContact = function(contact) { + * contact.type = 'phone'; + * contact.value = ''; + * }; + * } + * + * + * it('should check controller', function() { + * var container = element(by.id('ctrl-exmpl')); + * + * expect(container.findElement(by.model('name')) + * .getAttribute('value')).toBe('John Smith'); + * + * var firstRepeat = + * container.findElement(by.repeater('contact in contacts').row(0)); + * var secondRepeat = + * container.findElement(by.repeater('contact in contacts').row(1)); + * + * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe('408 555 1212'); + * expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe('john.smith@example.org'); + * + * firstRepeat.findElement(by.linkText('clear')).click(); + * + * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe(''); + * + * container.findElement(by.linkText('add')).click(); + * + * expect(container.findElement(by.repeater('contact in contacts').row(2)) + * .findElement(by.model('contact.value')) + * .getAttribute('value')) + * .toBe('yourname@example.org'); + * }); + * + *
*/ var ngControllerDirective = [function() { @@ -27704,7 +28539,7 @@ var ngControllerDirective = [function() { /** * @ngdoc directive - * @name ng.directive:ngCsp + * @name ngCsp * * @element html * @description @@ -27731,13 +28566,13 @@ var ngControllerDirective = [function() { * * @example * This example shows how to apply the `ngCsp` directive to the `html` tag. -
+   ```html
      
      
      ...
      ...
      
-   
+ ``` */ // ngCsp is not implemented as a proper directive any more, because we need it be processed while we bootstrap @@ -27746,7 +28581,7 @@ var ngControllerDirective = [function() { /** * @ngdoc directive - * @name ng.directive:ngClick + * @name ngClick * * @description * The ngClick directive allows you to specify custom behavior when @@ -27755,24 +28590,24 @@ var ngControllerDirective = [function() { * @element ANY * @priority 0 * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon - * click. (Event object is available as `$event`) + * click. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + it('should check ng-click', function() { expect(element(by.binding('count')).getText()).toMatch('0'); - element(by.css('.doc-example-live button')).click(); + element(by.css('button')).click(); expect(element(by.binding('count')).getText()).toMatch('1'); }); - - + + */ /* * A directive that allows creation of custom onclick handlers that are defined as angular @@ -27804,7 +28639,7 @@ forEach( /** * @ngdoc directive - * @name ng.directive:ngDblclick + * @name ngDblclick * * @description * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event. @@ -27815,20 +28650,20 @@ forEach( * a dblclick. (The Event object is available as `$event`) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMousedown + * @name ngMousedown * * @description * The ngMousedown directive allows you to specify custom behavior on mousedown event. @@ -27836,23 +28671,23 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon - * mousedown. (Event object is available as `$event`) + * mousedown. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMouseup + * @name ngMouseup * * @description * Specify custom behavior on mouseup event. @@ -27860,22 +28695,22 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon - * mouseup. (Event object is available as `$event`) + * mouseup. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMouseover + * @name ngMouseover * * @description * Specify custom behavior on mouseover event. @@ -27883,23 +28718,23 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon - * mouseover. (Event object is available as `$event`) + * mouseover. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMouseenter + * @name ngMouseenter * * @description * Specify custom behavior on mouseenter event. @@ -27907,23 +28742,23 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon - * mouseenter. (Event object is available as `$event`) + * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMouseleave + * @name ngMouseleave * * @description * Specify custom behavior on mouseleave event. @@ -27931,23 +28766,23 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon - * mouseleave. (Event object is available as `$event`) + * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMousemove + * @name ngMousemove * * @description * Specify custom behavior on mousemove event. @@ -27955,23 +28790,23 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon - * mousemove. (Event object is available as `$event`) + * mousemove. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngKeydown + * @name ngKeydown * * @description * Specify custom behavior on keydown event. @@ -27982,18 +28817,18 @@ forEach( * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) * * @example - - + + key down count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngKeyup + * @name ngKeyup * * @description * Specify custom behavior on keyup event. @@ -28004,62 +28839,69 @@ forEach( * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) * * @example - - - - key up count: {{count}} - - + + +

Typing in the input box below updates the key count

+ key up count: {{count}} + +

Typing in the input box below updates the keycode

+ +

event keyCode: {{ event.keyCode }}

+

event altKey: {{ event.altKey }}

+
+
*/ /** * @ngdoc directive - * @name ng.directive:ngKeypress + * @name ngKeypress * * @description * Specify custom behavior on keypress event. * * @element ANY * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon - * keypress. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) + * keypress. ({@link guide/expression#-event- Event object is available as `$event`} + * and can be interrogated for keyCode, altKey, etc.) * * @example - - + + key press count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngSubmit + * @name ngSubmit * * @description * Enables binding angular expressions to onsubmit events. * * Additionally it prevents the default action (which for form means sending the request to the - * server and reloading the current page) **but only if the form does not contain an `action` - * attribute**. + * server and reloading the current page), but only if the form does not contain `action`, + * `data-action`, or `x-action` attributes. * * @element form * @priority 0 - * @param {expression} ngSubmit {@link guide/expression Expression} to eval. (Event object is available as `$event`) + * @param {expression} ngSubmit {@link guide/expression Expression} to eval. + * ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + Load inlined template
-
- + + it('should load template defined inside script tag', function() { element(by.css('#tpl-link')).click(); expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/); }); - -
+ + */ var scriptDirective = ['$templateCache', function($templateCache) { return { @@ -29943,7 +30807,7 @@ var scriptDirective = ['$templateCache', function($templateCache) { var ngOptionsMinErr = minErr('ngOptions'); /** * @ngdoc directive - * @name ng.directive:select + * @name select * @restrict E * * @description @@ -29961,7 +30825,7 @@ var ngOptionsMinErr = minErr('ngOptions'); * *
* **Note:** `ngModel` compares by reference, not value. This is important when binding to an - * array of objects. See an example {@link http://jsfiddle.net/qWzTb/ in this jsfiddle}. + * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/). *
* * Optionally, a single hard-coded `
+ * ``` * * * @param {string} expression String expression to compile. @@ -10569,9 +11013,9 @@ function getterFn(path, options, fullExp) { /** - * @ngdoc object - * @name ng.$parseProvider - * @function + * @ngdoc provider + * @name $parseProvider + * @kind function * * @description * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse} @@ -10591,8 +11035,7 @@ function $ParseProvider() { * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future. * * @ngdoc method - * @name ng.$parseProvider#unwrapPromises - * @methodOf ng.$parseProvider + * @name $parseProvider#unwrapPromises * @description * * **This feature is deprecated, see deprecation notes below for more info** @@ -10646,8 +11089,7 @@ function $ParseProvider() { * @deprecated Promise unwrapping via $parse is deprecated and will be removed in the future. * * @ngdoc method - * @name ng.$parseProvider#logPromiseWarnings - * @methodOf ng.$parseProvider + * @name $parseProvider#logPromiseWarnings * @description * * Controls whether Angular should log a warning on any encounter of a promise in an expression. @@ -10692,7 +11134,7 @@ function $ParseProvider() { var lexer = new Lexer($parseOptions); var parser = new Parser(lexer, $filter, $parseOptions); - parsedExpression = parser.parse(exp, false); + parsedExpression = parser.parse(exp); if (exp !== 'hasOwnProperty') { // Only cache the value if it's not going to mess up the cache object @@ -10714,7 +11156,7 @@ function $ParseProvider() { /** * @ngdoc service - * @name ng.$q + * @name $q * @requires $rootScope * * @description @@ -10727,10 +11169,10 @@ function $ParseProvider() { * From the perspective of dealing with error handling, deferred and promise APIs are to * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming. * - *
+ * ```js
  *   // for the purpose of this example let's assume that variables `$q`, `scope` and `okToGreet`
  *   // are available in the current lexical scope (they could have been injected or passed in).
- * 
+ *
  *   function asyncGreet(name) {
  *     var deferred = $q.defer();
  *
@@ -10759,7 +11201,7 @@ function $ParseProvider() {
  *   }, function(update) {
  *     alert('Got notification: ' + update);
  *   });
- * 
+ * ``` * * At first it might not be obvious why this extra complexity is worth the trouble. The payoff * comes in the way of guarantees that promise and deferred APIs make, see @@ -10824,21 +11266,21 @@ function $ParseProvider() { * * Because `finally` is a reserved word in JavaScript and reserved keywords are not supported as * property names by ES3, you'll need to invoke the method like `promise['finally'](callback)` to - * make your code IE8 compatible. + * make your code IE8 and Android 2.x compatible. * * # Chaining promises * * Because calling the `then` method of a promise returns a new derived promise, it is easily * possible to create a chain of promises: * - *
+ * ```js
  *   promiseB = promiseA.then(function(result) {
  *     return result + 1;
  *   });
  *
  *   // promiseB will be resolved immediately after promiseA is resolved and its value
  *   // will be the result of promiseA incremented by 1
- * 
+ * ``` * * It is possible to create chains of any length and since a promise can be resolved with another * promise (which will defer its resolution further), it is possible to pause/defer resolution of @@ -10858,7 +11300,7 @@ function $ParseProvider() { * * # Testing * - *
+ *  ```js
  *    it('should simulate promise', inject(function($q, $rootScope) {
  *      var deferred = $q.defer();
  *      var promise = deferred.promise;
@@ -10878,7 +11320,7 @@ function $ParseProvider() {
  *      $rootScope.$apply();
  *      expect(resolvedValue).toEqual(123);
  *    }));
- *  
+ * ``` */ function $QProvider() { @@ -10893,7 +11335,7 @@ function $QProvider() { /** * Constructs a promise manager. * - * @param {function(function)} nextTick Function for executing functions in the next turn. + * @param {function(Function)} nextTick Function for executing functions in the next turn. * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for * debugging purposes. * @returns {object} Promise manager. @@ -10901,9 +11343,10 @@ function $QProvider() { function qFactory(nextTick, exceptionHandler) { /** - * @ngdoc - * @name ng.$q#defer - * @methodOf ng.$q + * @ngdoc method + * @name $q#defer + * @kind function + * * @description * Creates a `Deferred` object which represents a task which will finish in the future. * @@ -11057,9 +11500,10 @@ function qFactory(nextTick, exceptionHandler) { /** - * @ngdoc - * @name ng.$q#reject - * @methodOf ng.$q + * @ngdoc method + * @name $q#reject + * @kind function + * * @description * Creates a promise that is resolved as rejected with the specified `reason`. This api should be * used to forward rejection in a chain of promises. If you are dealing with the last promise in @@ -11071,7 +11515,7 @@ function qFactory(nextTick, exceptionHandler) { * current promise, you have to "rethrow" the error by returning a rejection constructed via * `reject`. * - *
+   * ```js
    *   promiseB = promiseA.then(function(result) {
    *     // success: do something and resolve promiseB
    *     //          with the old or a new result
@@ -11086,7 +11530,7 @@ function qFactory(nextTick, exceptionHandler) {
    *     }
    *     return $q.reject(reason);
    *   });
-   * 
+ * ``` * * @param {*} reason Constant, message, exception or an object representing the rejection reason. * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`. @@ -11116,9 +11560,10 @@ function qFactory(nextTick, exceptionHandler) { /** - * @ngdoc - * @name ng.$q#when - * @methodOf ng.$q + * @ngdoc method + * @name $q#when + * @kind function + * * @description * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. * This is useful when you are dealing with an object that might or might not be a promise, or if @@ -11187,9 +11632,10 @@ function qFactory(nextTick, exceptionHandler) { /** - * @ngdoc - * @name ng.$q#all - * @methodOf ng.$q + * @ngdoc method + * @name $q#all + * @kind function + * * @description * Combines multiple promises into a single promise that is resolved when all of the input * promises are resolved. @@ -11232,6 +11678,38 @@ function qFactory(nextTick, exceptionHandler) { }; } +function $$RAFProvider(){ //rAF + this.$get = ['$window', '$timeout', function($window, $timeout) { + var requestAnimationFrame = $window.requestAnimationFrame || + $window.webkitRequestAnimationFrame || + $window.mozRequestAnimationFrame; + + var cancelAnimationFrame = $window.cancelAnimationFrame || + $window.webkitCancelAnimationFrame || + $window.mozCancelAnimationFrame || + $window.webkitCancelRequestAnimationFrame; + + var rafSupported = !!requestAnimationFrame; + var raf = rafSupported + ? function(fn) { + var id = requestAnimationFrame(fn); + return function() { + cancelAnimationFrame(id); + }; + } + : function(fn) { + var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666 + return function() { + $timeout.cancel(timer); + }; + }; + + raf.supported = rafSupported; + + return raf; + }]; +} + /** * DESIGN NOTES * @@ -11247,7 +11725,7 @@ function qFactory(nextTick, exceptionHandler) { * * Loop operations are optimized by using while(count--) { ... } * - this means that in order to keep the same order of execution as addition we have to add - * items to the array at the beginning (shift) instead of at the end (push) + * items to the array at the beginning (unshift) instead of at the end (push) * * Child scopes are created and removed often * - Using an array would be slow since inserts in middle are expensive so we use linked list @@ -11259,17 +11737,16 @@ function qFactory(nextTick, exceptionHandler) { /** - * @ngdoc object - * @name ng.$rootScopeProvider + * @ngdoc provider + * @name $rootScopeProvider * @description * * Provider for the $rootScope service. */ /** - * @ngdoc function - * @name ng.$rootScopeProvider#digestTtl - * @methodOf ng.$rootScopeProvider + * @ngdoc method + * @name $rootScopeProvider#digestTtl * @description * * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and @@ -11290,8 +11767,8 @@ function qFactory(nextTick, exceptionHandler) { /** - * @ngdoc object - * @name ng.$rootScope + * @ngdoc service + * @name $rootScope * @description * * Every application has a single root {@link ng.$rootScope.Scope scope}. @@ -11316,23 +11793,23 @@ function $RootScopeProvider(){ function( $injector, $exceptionHandler, $parse, $browser) { /** - * @ngdoc function - * @name ng.$rootScope.Scope + * @ngdoc type + * @name $rootScope.Scope * * @description * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the - * {@link AUTO.$injector $injector}. Child scopes are created using the - * {@link ng.$rootScope.Scope#methods_$new $new()} method. (Most scopes are created automatically when + * {@link auto.$injector $injector}. Child scopes are created using the + * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when * compiled HTML template is executed.) * * Here is a simple scope snippet to show how you can interact with the scope. - *
+     * ```html
      * 
-     * 
+ * ``` * * # Inheritance * A scope can inherit from a parent scope, as in this example: - *
+     * ```js
          var parent = $rootScope;
          var child = parent.$new();
 
@@ -11343,7 +11820,7 @@ function $RootScopeProvider(){
          child.salutation = "Welcome";
          expect(child.salutation).toEqual('Welcome');
          expect(parent.salutation).toEqual('Hello');
-     * 
+ * ``` * * * @param {Object.=} providers Map of service factory which need to be @@ -11371,8 +11848,7 @@ function $RootScopeProvider(){ /** * @ngdoc property - * @name ng.$rootScope.Scope#$id - * @propertyOf ng.$rootScope.Scope + * @name $rootScope.Scope#$id * @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for * debugging. */ @@ -11381,19 +11857,18 @@ function $RootScopeProvider(){ Scope.prototype = { constructor: Scope, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$new - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$new + * @kind function * * @description * Creates a new child {@link ng.$rootScope.Scope scope}. * - * The parent scope will propagate the {@link ng.$rootScope.Scope#methods_$digest $digest()} and - * {@link ng.$rootScope.Scope#methods_$digest $digest()} events. The scope can be removed from the - * scope hierarchy using {@link ng.$rootScope.Scope#methods_$destroy $destroy()}. + * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} and + * {@link ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the + * scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}. * - * {@link ng.$rootScope.Scope#methods_$destroy $destroy()} must be called on a scope when it is + * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is * desired for the scope and its child scopes to be permanently detached from the parent and * thus stop participating in model change detection and listener notification by invoking. * @@ -11416,18 +11891,23 @@ function $RootScopeProvider(){ child.$$asyncQueue = this.$$asyncQueue; child.$$postDigestQueue = this.$$postDigestQueue; } else { - ChildScope = function() {}; // should be anonymous; This is so that when the minifier munges - // the name it does not become random set of chars. This will then show up as class - // name in the web inspector. - ChildScope.prototype = this; - child = new ChildScope(); - child.$id = nextUid(); + // Only create a child scope class if somebody asks for one, + // but cache it to allow the VM to optimize lookups. + if (!this.$$childScopeClass) { + this.$$childScopeClass = function() { + this.$$watchers = this.$$nextSibling = + this.$$childHead = this.$$childTail = null; + this.$$listeners = {}; + this.$$listenerCount = {}; + this.$id = nextUid(); + this.$$childScopeClass = null; + }; + this.$$childScopeClass.prototype = this; + } + child = new this.$$childScopeClass(); } child['this'] = child; - child.$$listeners = {}; - child.$$listenerCount = {}; child.$parent = this; - child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null; child.$$prevSibling = this.$$childTail; if (this.$$childHead) { this.$$childTail.$$nextSibling = child; @@ -11439,37 +11919,40 @@ function $RootScopeProvider(){ }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$watch - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$watch + * @kind function * * @description * Registers a `listener` callback to be executed whenever the `watchExpression` changes. * - * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#methods_$digest + * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest * $digest()} and should return the value that will be watched. (Since - * {@link ng.$rootScope.Scope#methods_$digest $digest()} reruns when it detects changes the + * {@link ng.$rootScope.Scope#$digest $digest()} reruns when it detects changes the * `watchExpression` can execute multiple times per - * {@link ng.$rootScope.Scope#methods_$digest $digest()} and should be idempotent.) + * {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.) * - The `listener` is called only when the value from the current `watchExpression` and the * previous call to `watchExpression` are not equal (with the exception of the initial run, - * see below). The inequality is determined according to - * {@link angular.equals} function. To save the value of the object for later comparison, - * the {@link angular.copy} function is used. It also means that watching complex options - * will have adverse memory and performance implications. + * see below). Inequality is determined according to reference inequality, + * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators) + * via the `!==` Javascript operator, unless `objectEquality == true` + * (see next point) + * - When `objectEquality == true`, inequality of the `watchExpression` is determined + * according to the {@link angular.equals} function. To save the value of the object for + * later comparison, the {@link angular.copy} function is used. This therefore means that + * watching complex objects will have adverse memory and performance implications. * - The watch `listener` may change the model, which may trigger other `listener`s to fire. * This is achieved by rerunning the watchers until no changes are detected. The rerun * iteration limit is 10 to prevent an infinite loop deadlock. * * - * If you want to be notified whenever {@link ng.$rootScope.Scope#methods_$digest $digest} is called, + * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called, * you can register a `watchExpression` function with no `listener`. (Since `watchExpression` - * can execute multiple times per {@link ng.$rootScope.Scope#methods_$digest $digest} cycle when a + * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a * change is detected, be prepared for multiple calls to your listener.) * * After a watcher is registered with the scope, the `listener` fn is called asynchronously - * (via {@link ng.$rootScope.Scope#methods_$evalAsync $evalAsync}) to initialize the + * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the * watcher. In rare cases, this is undesirable because the listener is called when the result * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the @@ -11479,7 +11962,7 @@ function $RootScopeProvider(){ * * * # Example - *
+       * ```js
            // let's assume that scope was dependency injected as the $rootScope
            var scope = $rootScope;
            scope.name = 'misko';
@@ -11492,13 +11975,17 @@ function $RootScopeProvider(){
            expect(scope.counter).toEqual(0);
 
            scope.$digest();
-           // no variable change
-           expect(scope.counter).toEqual(0);
+           // the listener is always called during the first $digest loop after it was registered
+           expect(scope.counter).toEqual(1);
 
-           scope.name = 'adam';
            scope.$digest();
+           // but now it will not be called unless the value changes
            expect(scope.counter).toEqual(1);
 
+           scope.name = 'adam';
+           scope.$digest();
+           expect(scope.counter).toEqual(2);
+
 
 
            // Using a listener function
@@ -11528,12 +12015,12 @@ function $RootScopeProvider(){
            scope.$digest();
            expect(scope.foodCounter).toEqual(1);
 
-       * 
+ * ``` * * * * @param {(function()|string)} watchExpression Expression that is evaluated on each - * {@link ng.$rootScope.Scope#methods_$digest $digest} cycle. A change in the return value triggers + * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers * a call to the `listener`. * * - `string`: Evaluated as {@link guide/expression expression} @@ -11545,7 +12032,8 @@ function $RootScopeProvider(){ * - `function(newValue, oldValue, scope)`: called with current and previous values as * parameters. * - * @param {boolean=} objectEquality Compare object for equality rather than for reference. + * @param {boolean=} objectEquality Compare for object equality using {@link angular.equals} instead of + * comparing for reference equality. * @returns {function()} Returns a deregistration function for this listener. */ $watch: function(watchExp, listener, objectEquality) { @@ -11583,7 +12071,7 @@ function $RootScopeProvider(){ // the while loop reads in reverse order. array.unshift(watcher); - return function() { + return function deregisterWatch() { arrayRemove(array, watcher); lastDirtyWatch = null; }; @@ -11591,10 +12079,9 @@ function $RootScopeProvider(){ /** - * @ngdoc function - * @name ng.$rootScope.Scope#$watchCollection - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$watchCollection + * @kind function * * @description * Shallow watches the properties of an object and fires whenever any of the properties change @@ -11608,7 +12095,7 @@ function $RootScopeProvider(){ * * * # Example - *
+       * ```js
           $scope.names = ['igor', 'matias', 'misko', 'james'];
           $scope.dataCount = 4;
 
@@ -11627,38 +12114,48 @@ function $RootScopeProvider(){
 
           //now there's been a change
           expect($scope.dataCount).toEqual(3);
-       * 
+ * ``` * * - * @param {string|Function(scope)} obj Evaluated as {@link guide/expression expression}. The + * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The * expression value should evaluate to an object or an array which is observed on each - * {@link ng.$rootScope.Scope#methods_$digest $digest} cycle. Any shallow change within the + * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the * collection will trigger a call to the `listener`. * - * @param {function(newCollection, oldCollection, scope)} listener a callback function that is - * fired with both the `newCollection` and `oldCollection` as parameters. - * The `newCollection` object is the newly modified data obtained from the `obj` expression - * and the `oldCollection` object is a copy of the former collection data. - * The `scope` refers to the current scope. + * @param {function(newCollection, oldCollection, scope)} listener a callback function called + * when a change is detected. + * - The `newCollection` object is the newly modified data obtained from the `obj` expression + * - The `oldCollection` object is a copy of the former collection data. + * Due to performance considerations, the`oldCollection` value is computed only if the + * `listener` function declares two or more arguments. + * - The `scope` argument refers to the current scope. * * @returns {function()} Returns a de-registration function for this listener. When the * de-registration function is executed, the internal watch operation is terminated. */ $watchCollection: function(obj, listener) { var self = this; - var oldValue; + // the current value, updated on each dirty-check run var newValue; + // a shallow copy of the newValue from the last dirty-check run, + // updated to match newValue during dirty-check run + var oldValue; + // a shallow copy of the newValue from when the last change happened + var veryOldValue; + // only track veryOldValue if the listener is asking for it + var trackVeryOldValue = (listener.length > 1); var changeDetected = 0; var objGetter = $parse(obj); var internalArray = []; var internalObject = {}; + var initRun = true; var oldLength = 0; function $watchCollectionWatch() { newValue = objGetter(self); var newLength, key; - if (!isObject(newValue)) { + if (!isObject(newValue)) { // if primitive if (oldValue !== newValue) { oldValue = newValue; changeDetected++; @@ -11680,7 +12177,9 @@ function $RootScopeProvider(){ } // copy the items to oldValue and look for changes. for (var i = 0; i < newLength; i++) { - if (oldValue[i] !== newValue[i]) { + var bothNaN = (oldValue[i] !== oldValue[i]) && + (newValue[i] !== newValue[i]); + if (!bothNaN && (oldValue[i] !== newValue[i])) { changeDetected++; oldValue[i] = newValue[i]; } @@ -11724,40 +12223,64 @@ function $RootScopeProvider(){ } function $watchCollectionAction() { - listener(newValue, oldValue, self); + if (initRun) { + initRun = false; + listener(newValue, newValue, self); + } else { + listener(newValue, veryOldValue, self); + } + + // make a copy for the next time a collection is changed + if (trackVeryOldValue) { + if (!isObject(newValue)) { + //primitive + veryOldValue = newValue; + } else if (isArrayLike(newValue)) { + veryOldValue = new Array(newValue.length); + for (var i = 0; i < newValue.length; i++) { + veryOldValue[i] = newValue[i]; + } + } else { // if object + veryOldValue = {}; + for (var key in newValue) { + if (hasOwnProperty.call(newValue, key)) { + veryOldValue[key] = newValue[key]; + } + } + } + } } return this.$watch($watchCollectionWatch, $watchCollectionAction); }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$digest - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$digest + * @kind function * * @description - * Processes all of the {@link ng.$rootScope.Scope#methods_$watch watchers} of the current scope and - * its children. Because a {@link ng.$rootScope.Scope#methods_$watch watcher}'s listener can change - * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#methods_$watch watchers} + * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and + * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change + * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers} * until no more listeners are firing. This means that it is possible to get into an infinite * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of * iterations exceeds 10. * * Usually, you don't call `$digest()` directly in * {@link ng.directive:ngController controllers} or in - * {@link ng.$compileProvider#methods_directive directives}. - * Instead, you should call {@link ng.$rootScope.Scope#methods_$apply $apply()} (typically from within - * a {@link ng.$compileProvider#methods_directive directives}), which will force a `$digest()`. + * {@link ng.$compileProvider#directive directives}. + * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within + * a {@link ng.$compileProvider#directive directives}), which will force a `$digest()`. * * If you want to be notified whenever `$digest()` is called, * you can register a `watchExpression` function with - * {@link ng.$rootScope.Scope#methods_$watch $watch()} with no `listener`. + * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`. * * In unit tests, you may need to call `$digest()` to simulate the scope life cycle. * * # Example - *
+       * ```js
            var scope = ...;
            scope.name = 'misko';
            scope.counter = 0;
@@ -11769,13 +12292,17 @@ function $RootScopeProvider(){
            expect(scope.counter).toEqual(0);
 
            scope.$digest();
-           // no variable change
-           expect(scope.counter).toEqual(0);
+           // the listener is always called during the first $digest loop after it was registered
+           expect(scope.counter).toEqual(1);
 
-           scope.name = 'adam';
            scope.$digest();
+           // but now it will not be called unless the value changes
            expect(scope.counter).toEqual(1);
-       * 
+ + scope.name = 'adam'; + scope.$digest(); + expect(scope.counter).toEqual(2); + * ``` * */ $digest: function() { @@ -11826,7 +12353,7 @@ function $RootScopeProvider(){ && isNaN(value) && isNaN(last)))) { dirty = true; lastDirtyWatch = watch; - watch.last = watch.eq ? copy(value) : value; + watch.last = watch.eq ? copy(value, null) : value; watch.fn(value, ((last === initWatchVal) ? value : last), current); if (ttl < 5) { logIdx = 4 - ttl; @@ -11888,8 +12415,7 @@ function $RootScopeProvider(){ /** * @ngdoc event - * @name ng.$rootScope.Scope#$destroy - * @eventOf ng.$rootScope.Scope + * @name $rootScope.Scope#$destroy * @eventType broadcast on scope being destroyed * * @description @@ -11900,14 +12426,13 @@ function $RootScopeProvider(){ */ /** - * @ngdoc function - * @name ng.$rootScope.Scope#$destroy - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$destroy + * @kind function * * @description * Removes the current scope (and all of its children) from the parent scope. Removal implies - * that calls to {@link ng.$rootScope.Scope#methods_$digest $digest()} will no longer + * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer * propagate to the current scope and its children. Removal also implies that the current * scope is eligible for garbage collection. * @@ -11933,22 +12458,38 @@ function $RootScopeProvider(){ forEach(this.$$listenerCount, bind(null, decrementListenerCount, this)); + // sever all the references to parent scopes (after this cleanup, the current scope should + // not be retained by any of our references and should be eligible for garbage collection) if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling; if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling; if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling; if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling; - // This is bogus code that works around Chrome's GC leak - // see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 + + // All of the code below is bogus code that works around V8's memory leak via optimized code + // and inline caches. + // + // see: + // - https://code.google.com/p/v8/issues/detail?id=2073#c26 + // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909 + // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 + this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead = - this.$$childTail = null; + this.$$childTail = this.$root = null; + + // don't reset these to null in case some async task tries to register a listener/watch/task + this.$$listeners = {}; + this.$$watchers = this.$$asyncQueue = this.$$postDigestQueue = []; + + // prevent NPEs since these methods have references to properties we nulled out + this.$destroy = this.$digest = this.$apply = noop; + this.$on = this.$watch = function() { return noop; }; }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$eval - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$eval + * @kind function * * @description * Executes the `expression` on the current scope and returns the result. Any exceptions in @@ -11956,14 +12497,14 @@ function $RootScopeProvider(){ * expressions. * * # Example - *
+       * ```js
            var scope = ng.$rootScope.Scope();
            scope.a = 1;
            scope.b = 2;
 
            expect(scope.$eval('a+b')).toEqual(3);
            expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
-       * 
+ * ``` * * @param {(string|function())=} expression An angular expression to be executed. * @@ -11978,10 +12519,9 @@ function $RootScopeProvider(){ }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$evalAsync - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$evalAsync + * @kind function * * @description * Executes the expression on the current scope at a later point in time. @@ -11991,7 +12531,7 @@ function $RootScopeProvider(){ * * - it will execute after the function that scheduled the evaluation (preferably before DOM * rendering). - * - at least one {@link ng.$rootScope.Scope#methods_$digest $digest cycle} will be performed after + * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after * `expression` execution. * * Any exceptions from the execution of the expression are forwarded to the @@ -12026,22 +12566,21 @@ function $RootScopeProvider(){ }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$apply - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$apply + * @kind function * * @description * `$apply()` is used to execute an expression in angular from outside of the angular * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries). * Because we are calling into the angular framework we need to perform proper scope life * cycle of {@link ng.$exceptionHandler exception handling}, - * {@link ng.$rootScope.Scope#methods_$digest executing watches}. + * {@link ng.$rootScope.Scope#$digest executing watches}. * * ## Life cycle * * # Pseudo-Code of `$apply()` - *
+       * ```js
            function $apply(expr) {
              try {
                return $eval(expr);
@@ -12051,17 +12590,17 @@ function $RootScopeProvider(){
                $root.$digest();
              }
            }
-       * 
+ * ``` * * * Scope's `$apply()` method transitions through the following stages: * * 1. The {@link guide/expression expression} is executed using the - * {@link ng.$rootScope.Scope#methods_$eval $eval()} method. + * {@link ng.$rootScope.Scope#$eval $eval()} method. * 2. Any exceptions from the execution of the expression are forwarded to the * {@link ng.$exceptionHandler $exceptionHandler} service. - * 3. The {@link ng.$rootScope.Scope#methods_$watch watch} listeners are fired immediately after the - * expression was executed using the {@link ng.$rootScope.Scope#methods_$digest $digest()} method. + * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the + * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method. * * * @param {(string|function())=} exp An angular expression to be executed. @@ -12089,13 +12628,12 @@ function $RootScopeProvider(){ }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$on - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$on + * @kind function * * @description - * Listens on events of a given type. See {@link ng.$rootScope.Scope#methods_$emit $emit} for + * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for * discussion of event life cycle. * * The event listener function format is: `function(event, args...)`. The `event` object @@ -12112,7 +12650,7 @@ function $RootScopeProvider(){ * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called. * * @param {string} name Event name to listen on. - * @param {function(event, args...)} listener Function to call when the event is emitted. + * @param {function(event, ...args)} listener Function to call when the event is emitted. * @returns {function()} Returns a deregistration function for this listener. */ $on: function(name, listener) { @@ -12139,27 +12677,26 @@ function $RootScopeProvider(){ /** - * @ngdoc function - * @name ng.$rootScope.Scope#$emit - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$emit + * @kind function * * @description * Dispatches an event `name` upwards through the scope hierarchy notifying the - * registered {@link ng.$rootScope.Scope#methods_$on} listeners. + * registered {@link ng.$rootScope.Scope#$on} listeners. * * The event life cycle starts at the scope on which `$emit` was called. All - * {@link ng.$rootScope.Scope#methods_$on listeners} listening for `name` event on this scope get + * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get * notified. Afterwards, the event traverses upwards toward the root scope and calls all * registered listeners along the way. The event will stop propagating if one of the listeners * cancels it. * - * Any exception emitted from the {@link ng.$rootScope.Scope#methods_$on listeners} will be passed + * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed * onto the {@link ng.$exceptionHandler $exceptionHandler} service. * * @param {string} name Event name to emit. * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. - * @return {Object} Event object (see {@link ng.$rootScope.Scope#methods_$on}). + * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}). */ $emit: function(name, args) { var empty = [], @@ -12208,26 +12745,25 @@ function $RootScopeProvider(){ /** - * @ngdoc function - * @name ng.$rootScope.Scope#$broadcast - * @methodOf ng.$rootScope.Scope - * @function + * @ngdoc method + * @name $rootScope.Scope#$broadcast + * @kind function * * @description * Dispatches an event `name` downwards to all child scopes (and their children) notifying the - * registered {@link ng.$rootScope.Scope#methods_$on} listeners. + * registered {@link ng.$rootScope.Scope#$on} listeners. * * The event life cycle starts at the scope on which `$broadcast` was called. All - * {@link ng.$rootScope.Scope#methods_$on listeners} listening for `name` event on this scope get + * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get * notified. Afterwards, the event propagates to all direct and indirect scopes of the current * scope and calls all registered listeners along the way. The event cannot be canceled. * - * Any exception emitted from the {@link ng.$rootScope.Scope#methods_$on listeners} will be passed + * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed * onto the {@link ng.$exceptionHandler $exceptionHandler} service. * * @param {string} name Event name to broadcast. * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. - * @return {Object} Event object, see {@link ng.$rootScope.Scope#methods_$on} + * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on} */ $broadcast: function(name, args) { var target = this, @@ -12458,8 +12994,8 @@ function adjustMatchers(matchers) { /** * @ngdoc service - * @name ng.$sceDelegate - * @function + * @name $sceDelegate + * @kind function * * @description * @@ -12478,21 +13014,21 @@ function adjustMatchers(matchers) { * can override it completely to change the behavior of `$sce`, the common case would * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as - * templates. Refer {@link ng.$sceDelegateProvider#methods_resourceUrlWhitelist + * templates. Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist * $sceDelegateProvider.resourceUrlWhitelist} and {@link - * ng.$sceDelegateProvider#methods_resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} + * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} */ /** - * @ngdoc object - * @name ng.$sceDelegateProvider + * @ngdoc provider + * @name $sceDelegateProvider * @description * * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate * $sceDelegate} service. This allows one to get/set the whitelists and blacklists used to ensure * that the URLs used for sourcing Angular templates are safe. Refer {@link - * ng.$sceDelegateProvider#methods_resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and - * {@link ng.$sceDelegateProvider#methods_resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} + * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and + * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist} * * For the general details about this service in Angular, read the main page for {@link ng.$sce * Strict Contextual Escaping (SCE)}. @@ -12529,10 +13065,9 @@ function $SceDelegateProvider() { resourceUrlBlacklist = []; /** - * @ngdoc function - * @name ng.sceDelegateProvider#resourceUrlWhitelist - * @methodOf ng.$sceDelegateProvider - * @function + * @ngdoc method + * @name $sceDelegateProvider#resourceUrlWhitelist + * @kind function * * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value * provided. This must be an array or null. A snapshot of this array is used so further @@ -12559,10 +13094,9 @@ function $SceDelegateProvider() { }; /** - * @ngdoc function - * @name ng.sceDelegateProvider#resourceUrlBlacklist - * @methodOf ng.$sceDelegateProvider - * @function + * @ngdoc method + * @name $sceDelegateProvider#resourceUrlBlacklist + * @kind function * * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value * provided. This must be an array or null. A snapshot of this array is used so further @@ -12664,8 +13198,7 @@ function $SceDelegateProvider() { /** * @ngdoc method - * @name ng.$sceDelegate#trustAs - * @methodOf ng.$sceDelegate + * @name $sceDelegate#trustAs * * @description * Returns an object that is trusted by angular for use in specified strict @@ -12702,20 +13235,19 @@ function $SceDelegateProvider() { /** * @ngdoc method - * @name ng.$sceDelegate#valueOf - * @methodOf ng.$sceDelegate + * @name $sceDelegate#valueOf * * @description - * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#methods_trustAs + * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link - * ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}. + * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. * * If the passed parameter is not a value that had been returned by {@link - * ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}, returns it as-is. + * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is. * - * @param {*} value The result of a prior {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`} + * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} * call or anything else. - * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#methods_trustAs + * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs * `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns * `value` unchanged. */ @@ -12729,18 +13261,17 @@ function $SceDelegateProvider() { /** * @ngdoc method - * @name ng.$sceDelegate#getTrusted - * @methodOf ng.$sceDelegate + * @name $sceDelegate#getTrusted * * @description - * Takes the result of a {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`} call and + * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and * returns the originally supplied value if the queried context type is a supertype of the * created type. If this condition isn't satisfied, throws an exception. * * @param {string} type The kind of context in which this value is to be used. - * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#methods_trustAs + * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs * `$sceDelegate.trustAs`} call. - * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#methods_trustAs + * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs * `$sceDelegate.trustAs`} if valid in this context. Otherwise, throws an exception. */ function getTrusted(type, maybeTrusted) { @@ -12776,8 +13307,8 @@ function $SceDelegateProvider() { /** - * @ngdoc object - * @name ng.$sceProvider + * @ngdoc provider + * @name $sceProvider * @description * * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service. @@ -12791,8 +13322,8 @@ function $SceDelegateProvider() { /** * @ngdoc service - * @name ng.$sce - * @function + * @name $sce + * @kind function * * @description * @@ -12845,20 +13376,20 @@ function $SceDelegateProvider() { * allowing only the files in a specific directory to do this. Ensuring that the internal API * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task. * - * In the case of AngularJS' SCE service, one uses {@link ng.$sce#methods_trustAs $sce.trustAs} - * (and shorthand methods such as {@link ng.$sce#methods_trustAsHtml $sce.trustAsHtml}, etc.) to + * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs} + * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to * obtain values that will be accepted by SCE / privileged contexts. * * * ## How does it work? * - * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#methods_getTrusted + * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted * $sce.getTrusted(context, value)} rather than to the value directly. Directives use {@link - * ng.$sce#methods_parse $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the - * {@link ng.$sce#methods_getTrusted $sce.getTrusted} behind the scenes on non-constant literals. + * ng.$sce#parse $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the + * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals. * * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link - * ng.$sce#methods_parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly + * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly * simplified): * *
@@ -12877,15 +13408,15 @@ function $SceDelegateProvider() {
  * `templateUrl`'s specified by {@link guide/directive directives}.
  *
  * By default, Angular only loads templates from the same domain and protocol as the application
- * document.  This is done by calling {@link ng.$sce#methods_getTrustedResourceUrl
+ * document.  This is done by calling {@link ng.$sce#getTrustedResourceUrl
  * $sce.getTrustedResourceUrl} on the template URL.  To load templates from other domains and/or
- * protocols, you may either either {@link ng.$sceDelegateProvider#methods_resourceUrlWhitelist whitelist
- * them} or {@link ng.$sce#methods_trustAsResourceUrl wrap it} into a trusted value.
+ * protocols, you may either either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist
+ * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.
  *
  * *Please note*:
  * The browser's
- * {@link https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest
- * Same Origin Policy} and {@link http://www.w3.org/TR/cors/ Cross-Origin Resource Sharing (CORS)}
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
  * policy apply in addition to this and may further restrict whether the template is successfully
  * loaded.  This means that without the right CORS policy, loading templates from a different domain
  * won't work on all browsers.  Also, loading templates from `file://` URL does not work on some
@@ -12900,14 +13431,14 @@ function $SceDelegateProvider() {
  * `
`) just works. * * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them - * through {@link ng.$sce#methods_getTrusted $sce.getTrusted}. SCE doesn't play a role here. + * through {@link ng.$sce#getTrusted $sce.getTrusted}. SCE doesn't play a role here. * * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load * templates in `ng-include` from your application's domain without having to even know about SCE. * It blocks loading templates from other domains or loading templates over http from an https * served document. You can change these by setting your own custom {@link - * ng.$sceDelegateProvider#methods_resourceUrlWhitelist whitelists} and {@link - * ng.$sceDelegateProvider#methods_resourceUrlBlacklist blacklists} for matching such URLs. + * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link + * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs. * * This significantly reduces the overhead. It is far easier to pay the small overhead and have an * application that's secure and can be audited to verify that with much more ease than bolting @@ -12918,13 +13449,13 @@ function $SceDelegateProvider() { * * | Context | Notes | * |---------------------|----------------| - * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. | + * | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. | * | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. | - * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`
Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. | + * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`

Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. | * | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. | * - * ## Format of items in {@link ng.$sceDelegateProvider#methods_resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#methods_resourceUrlBlacklist Blacklist}
+ * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} * * Each element in these arrays must be one of the following: * @@ -12936,13 +13467,13 @@ function $SceDelegateProvider() { * being tested (substring matches are not good enough.) * - There are exactly **two wildcard sequences** - `*` and `**`. All other characters * match themselves. - * - `*`: matches zero or more occurances of any character other than one of the following 6 + * - `*`: matches zero or more occurrences of any character other than one of the following 6 * characters: '`:`', '`/`', '`.`', '`?`', '`&`' and ';'. It's a useful wildcard for use * in a whitelist. - * - `**`: matches zero or more occurances of *any* character. As such, it's not + * - `**`: matches zero or more occurrences of *any* character. As such, it's not * not appropriate to use in for a scheme, domain, etc. as it would match too much. (e.g. * http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might - * not have been the intention.) It's usage at the very end of the path is ok. (e.g. + * not have been the intention.) Its usage at the very end of the path is ok. (e.g. * http://foo.example.com/templates/**). * - **RegExp** (*see caveat below*) * - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax @@ -13018,7 +13549,7 @@ function $SceDelegateProvider() { ] - + describe('SCE doc demo', function() { it('should sanitize untrusted values', function() { expect(element(by.css('.htmlComment')).getInnerHtml()) @@ -13061,10 +13592,9 @@ function $SceProvider() { var enabled = true; /** - * @ngdoc function - * @name ng.sceProvider#enabled - * @methodOf ng.$sceProvider - * @function + * @ngdoc method + * @name $sceProvider#enabled + * @kind function * * @param {boolean=} value If provided, then enables/disables SCE. * @return {boolean} true if SCE is enabled, false otherwise. @@ -13137,13 +13667,12 @@ function $SceProvider() { 'document. See http://docs.angularjs.org/api/ng.$sce for more information.'); } - var sce = copy(SCE_CONTEXTS); + var sce = shallowCopy(SCE_CONTEXTS); /** - * @ngdoc function - * @name ng.sce#isEnabled - * @methodOf ng.$sce - * @function + * @ngdoc method + * @name $sce#isEnabled + * @kind function * * @return {Boolean} true if SCE is enabled, false otherwise. If you want to set the value, you * have to do it at module config time on {@link ng.$sceProvider $sceProvider}. @@ -13165,13 +13694,12 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#parse - * @methodOf ng.$sce + * @name $sce#parse * * @description * Converts Angular {@link guide/expression expression} into a function. This is like {@link * ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it - * wraps the expression in a call to {@link ng.$sce#methods_getTrusted $sce.getTrusted(*type*, + * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*, * *result*)} * * @param {string} type The kind of SCE context in which this result will be used. @@ -13196,11 +13724,10 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#trustAs - * @methodOf ng.$sce + * @name $sce#trustAs * * @description - * Delegates to {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}. As such, + * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such, * returns an object that is trusted by angular for use in specified strict contextual * escaping contexts (such as ng-bind-html, ng-include, any src attribute * interpolation, any dom event binding attribute interpolation such as for onclick, etc.) @@ -13216,95 +13743,89 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#trustAsHtml - * @methodOf ng.$sce + * @name $sce#trustAsHtml * * @description * Shorthand method. `$sce.trustAsHtml(value)` → - * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.HTML, value)`} + * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`} * * @param {*} value The value to trustAs. - * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedHtml + * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml * $sce.getTrustedHtml(value)} to obtain the original value. (privileged directives * only accept expressions that are either literal constants or are the - * return value of {@link ng.$sce#methods_trustAs $sce.trustAs}.) + * return value of {@link ng.$sce#trustAs $sce.trustAs}.) */ /** * @ngdoc method - * @name ng.$sce#trustAsUrl - * @methodOf ng.$sce + * @name $sce#trustAsUrl * * @description * Shorthand method. `$sce.trustAsUrl(value)` → - * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.URL, value)`} + * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`} * * @param {*} value The value to trustAs. - * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedUrl + * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl * $sce.getTrustedUrl(value)} to obtain the original value. (privileged directives * only accept expressions that are either literal constants or are the - * return value of {@link ng.$sce#methods_trustAs $sce.trustAs}.) + * return value of {@link ng.$sce#trustAs $sce.trustAs}.) */ /** * @ngdoc method - * @name ng.$sce#trustAsResourceUrl - * @methodOf ng.$sce + * @name $sce#trustAsResourceUrl * * @description * Shorthand method. `$sce.trustAsResourceUrl(value)` → - * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`} + * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`} * * @param {*} value The value to trustAs. - * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedResourceUrl + * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl * $sce.getTrustedResourceUrl(value)} to obtain the original value. (privileged directives * only accept expressions that are either literal constants or are the return - * value of {@link ng.$sce#methods_trustAs $sce.trustAs}.) + * value of {@link ng.$sce#trustAs $sce.trustAs}.) */ /** * @ngdoc method - * @name ng.$sce#trustAsJs - * @methodOf ng.$sce + * @name $sce#trustAsJs * * @description * Shorthand method. `$sce.trustAsJs(value)` → - * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.JS, value)`} + * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`} * * @param {*} value The value to trustAs. - * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedJs + * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs * $sce.getTrustedJs(value)} to obtain the original value. (privileged directives * only accept expressions that are either literal constants or are the - * return value of {@link ng.$sce#methods_trustAs $sce.trustAs}.) + * return value of {@link ng.$sce#trustAs $sce.trustAs}.) */ /** * @ngdoc method - * @name ng.$sce#getTrusted - * @methodOf ng.$sce + * @name $sce#getTrusted * * @description - * Delegates to {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted`}. As such, - * takes the result of a {@link ng.$sce#methods_trustAs `$sce.trustAs`}() call and returns the + * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such, + * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the * originally supplied value if the queried context type is a supertype of the created type. * If this condition isn't satisfied, throws an exception. * * @param {string} type The kind of context in which this value is to be used. - * @param {*} maybeTrusted The result of a prior {@link ng.$sce#methods_trustAs `$sce.trustAs`} + * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`} * call. * @returns {*} The value the was originally provided to - * {@link ng.$sce#methods_trustAs `$sce.trustAs`} if valid in this context. + * {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context. * Otherwise, throws an exception. */ /** * @ngdoc method - * @name ng.$sce#getTrustedHtml - * @methodOf ng.$sce + * @name $sce#getTrustedHtml * * @description * Shorthand method. `$sce.getTrustedHtml(value)` → - * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`} + * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`} * * @param {*} value The value to pass to `$sce.getTrusted`. * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)` @@ -13312,12 +13833,11 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#getTrustedCss - * @methodOf ng.$sce + * @name $sce#getTrustedCss * * @description * Shorthand method. `$sce.getTrustedCss(value)` → - * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`} + * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`} * * @param {*} value The value to pass to `$sce.getTrusted`. * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)` @@ -13325,12 +13845,11 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#getTrustedUrl - * @methodOf ng.$sce + * @name $sce#getTrustedUrl * * @description * Shorthand method. `$sce.getTrustedUrl(value)` → - * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.URL, value)`} + * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`} * * @param {*} value The value to pass to `$sce.getTrusted`. * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)` @@ -13338,12 +13857,11 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#getTrustedResourceUrl - * @methodOf ng.$sce + * @name $sce#getTrustedResourceUrl * * @description * Shorthand method. `$sce.getTrustedResourceUrl(value)` → - * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`} + * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`} * * @param {*} value The value to pass to `$sceDelegate.getTrusted`. * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)` @@ -13351,12 +13869,11 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#getTrustedJs - * @methodOf ng.$sce + * @name $sce#getTrustedJs * * @description * Shorthand method. `$sce.getTrustedJs(value)` → - * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.JS, value)`} + * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`} * * @param {*} value The value to pass to `$sce.getTrusted`. * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)` @@ -13364,12 +13881,11 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#parseAsHtml - * @methodOf ng.$sce + * @name $sce#parseAsHtml * * @description * Shorthand method. `$sce.parseAsHtml(expression string)` → - * {@link ng.$sce#methods_parse `$sce.parseAs($sce.HTML, value)`} + * {@link ng.$sce#parse `$sce.parseAs($sce.HTML, value)`} * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: @@ -13382,12 +13898,11 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#parseAsCss - * @methodOf ng.$sce + * @name $sce#parseAsCss * * @description * Shorthand method. `$sce.parseAsCss(value)` → - * {@link ng.$sce#methods_parse `$sce.parseAs($sce.CSS, value)`} + * {@link ng.$sce#parse `$sce.parseAs($sce.CSS, value)`} * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: @@ -13400,12 +13915,11 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#parseAsUrl - * @methodOf ng.$sce + * @name $sce#parseAsUrl * * @description * Shorthand method. `$sce.parseAsUrl(value)` → - * {@link ng.$sce#methods_parse `$sce.parseAs($sce.URL, value)`} + * {@link ng.$sce#parse `$sce.parseAs($sce.URL, value)`} * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: @@ -13418,12 +13932,11 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#parseAsResourceUrl - * @methodOf ng.$sce + * @name $sce#parseAsResourceUrl * * @description * Shorthand method. `$sce.parseAsResourceUrl(value)` → - * {@link ng.$sce#methods_parse `$sce.parseAs($sce.RESOURCE_URL, value)`} + * {@link ng.$sce#parse `$sce.parseAs($sce.RESOURCE_URL, value)`} * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: @@ -13436,12 +13949,11 @@ function $SceProvider() { /** * @ngdoc method - * @name ng.$sce#parseAsJs - * @methodOf ng.$sce + * @name $sce#parseAsJs * * @description * Shorthand method. `$sce.parseAsJs(value)` → - * {@link ng.$sce#methods_parse `$sce.parseAs($sce.JS, value)`} + * {@link ng.$sce#parse `$sce.parseAs($sce.JS, value)`} * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: @@ -13477,7 +13989,7 @@ function $SceProvider() { /** * !!! This is an undocumented "private" service !!! * - * @name ng.$sniffer + * @name $sniffer * @requires $window * @requires $document * @@ -13573,9 +14085,8 @@ function $TimeoutProvider() { /** - * @ngdoc function - * @name ng.$timeout - * @requires $browser + * @ngdoc service + * @name $timeout * * @description * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch @@ -13593,10 +14104,10 @@ function $TimeoutProvider() { * @param {function()} fn A function, whose execution should be delayed. * @param {number=} [delay=0] Delay in milliseconds. * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise - * will invoke `fn` within the {@link ng.$rootScope.Scope#methods_$apply $apply} block. + * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this * promise will be resolved with is the return value of the `fn` function. - * + * */ function timeout(fn, delay, invokeApply) { var deferred = $q.defer(), @@ -13626,9 +14137,8 @@ function $TimeoutProvider() { /** - * @ngdoc function - * @name ng.$timeout#cancel - * @methodOf ng.$timeout + * @ngdoc method + * @name $timeout#cancel * * @description * Cancels a task associated with the `promise`. As a result of this, the promise will be @@ -13697,7 +14207,7 @@ var originUrl = urlResolve(window.location.href, true); * https://github.com/angular/angular.js/pull/2902 * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/ * - * @function + * @kind function * @param {string} url The URL to be parsed. * @description Normalizes and parses a URL. * @returns {object} Returns the normalized URL as a dictionary. @@ -13755,8 +14265,8 @@ function urlIsSameOrigin(requestUrl) { } /** - * @ngdoc object - * @name ng.$window + * @ngdoc service + * @name $window * * @description * A reference to the browser's `window` object. While `window` @@ -13770,8 +14280,8 @@ function urlIsSameOrigin(requestUrl) { * expression. * * @example - - + + - + + userType: Required!
userType = {{userType}}
@@ -15583,8 +16228,8 @@ function FormController(element, attrs) { myForm.$valid = {{myForm.$valid}}
myForm.$error.required = {{!!myForm.$error.required}}
-
- +
+ it('should initialize to model', function() { var userType = element(by.binding('userType')); var valid = element(by.binding('myForm.input.$valid')); @@ -15604,8 +16249,9 @@ function FormController(element, attrs) { expect(userType.getText()).toEqual('userType ='); expect(valid.getText()).toContain('false'); }); - - + + + * */ var formDirectiveFactory = function(isNgForm) { return ['$timeout', function($timeout) { @@ -15682,8 +16328,8 @@ var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/; var inputType = { /** - * @ngdoc inputType - * @name ng.directive:input.text + * @ngdoc input + * @name input[text] * * @description * Standard HTML text input with angular data binding. @@ -15706,8 +16352,8 @@ var inputType = { * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input. * * @example - - + + + + Update input to see transitions when valid/invalid. + Integer is a valid value. +
+ +
+
+ *
*/ var ngModelDirective = function() { return { @@ -16913,7 +17662,7 @@ var ngModelDirective = function() { /** * @ngdoc directive - * @name ng.directive:ngChange + * @name ngChange * * @description * Evaluate the given expression when the user changes the input. @@ -16929,8 +17678,8 @@ var ngModelDirective = function() { * in input value. * * @example - * - * + * + * * -
- Name: - [ greet ]
- Contact: -
    -
  • - - - [ clear - | X ] -
  • -
  • [ add ]
  • -
-
-
- - it('should check controller as', function() { - var container = element(by.id('ctrl-as-exmpl')); - - expect(container.findElement(by.model('settings.name')) - .getAttribute('value')).toBe('John Smith'); - - var firstRepeat = - container.findElement(by.repeater('contact in settings.contacts').row(0)); - var secondRepeat = - container.findElement(by.repeater('contact in settings.contacts').row(1)); - - expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe('408 555 1212'); - expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe('john.smith@example.org'); - - firstRepeat.findElement(by.linkText('clear')).click() - - expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe(''); - - container.findElement(by.linkText('add')).click(); - - expect(container.findElement(by.repeater('contact in settings.contacts').row(2)) - .findElement(by.model('contact.value')) - .getAttribute('value')) - .toBe('yourname@example.org'); - }); - -
- - - -
- Name: - [ greet ]
- Contact: -
    -
  • - - - [ clear - | X ] -
  • -
  • [ add ]
  • -
-
-
- - it('should check controller', function() { - var container = element(by.id('ctrl-exmpl')); - - expect(container.findElement(by.model('name')) - .getAttribute('value')).toBe('John Smith'); - - var firstRepeat = - container.findElement(by.repeater('contact in contacts').row(0)); - var secondRepeat = - container.findElement(by.repeater('contact in contacts').row(1)); - - expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe('408 555 1212'); - expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe('john.smith@example.org'); - - firstRepeat.findElement(by.linkText('clear')).click() - - expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) - .toBe(''); - - container.findElement(by.linkText('add')).click(); - - expect(container.findElement(by.repeater('contact in contacts').row(2)) - .findElement(by.model('contact.value')) - .getAttribute('value')) - .toBe('yourname@example.org'); - }); - -
+ * easily be called from the angular markup. Any changes to the data are automatically reflected + * in the View without the need for a manual update. + * + * Two different declaration styles are included below: + * + * * one binds methods and properties directly onto the controller using `this`: + * `ng-controller="SettingsController1 as settings"` + * * one injects `$scope` into the controller: + * `ng-controller="SettingsController2"` + * + * The second option is more common in the Angular community, and is generally used in boilerplates + * and in this guide. However, there are advantages to binding properties directly to the controller + * and avoiding scope. + * + * * Using `controller as` makes it obvious which controller you are accessing in the template when + * multiple controllers apply to an element. + * * If you are writing your controllers as classes you have easier access to the properties and + * methods, which will appear on the scope, from inside the controller code. + * * Since there is always a `.` in the bindings, you don't have to worry about prototypal + * inheritance masking primitives. + * + * This example demonstrates the `controller as` syntax. + * + * + * + *
+ * Name: + * [ greet ]
+ * Contact: + *
    + *
  • + * + * + * [ clear + * | X ] + *
  • + *
  • [ add ]
  • + *
+ *
+ *
+ * + * function SettingsController1() { + * this.name = "John Smith"; + * this.contacts = [ + * {type: 'phone', value: '408 555 1212'}, + * {type: 'email', value: 'john.smith@example.org'} ]; + * } + * + * SettingsController1.prototype.greet = function() { + * alert(this.name); + * }; + * + * SettingsController1.prototype.addContact = function() { + * this.contacts.push({type: 'email', value: 'yourname@example.org'}); + * }; + * + * SettingsController1.prototype.removeContact = function(contactToRemove) { + * var index = this.contacts.indexOf(contactToRemove); + * this.contacts.splice(index, 1); + * }; + * + * SettingsController1.prototype.clearContact = function(contact) { + * contact.type = 'phone'; + * contact.value = ''; + * }; + * + * + * it('should check controller as', function() { + * var container = element(by.id('ctrl-as-exmpl')); + * expect(container.findElement(by.model('settings.name')) + * .getAttribute('value')).toBe('John Smith'); + * + * var firstRepeat = + * container.findElement(by.repeater('contact in settings.contacts').row(0)); + * var secondRepeat = + * container.findElement(by.repeater('contact in settings.contacts').row(1)); + * + * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe('408 555 1212'); + * + * expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe('john.smith@example.org'); + * + * firstRepeat.findElement(by.linkText('clear')).click(); + * + * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe(''); + * + * container.findElement(by.linkText('add')).click(); + * + * expect(container.findElement(by.repeater('contact in settings.contacts').row(2)) + * .findElement(by.model('contact.value')) + * .getAttribute('value')) + * .toBe('yourname@example.org'); + * }); + * + *
+ * + * This example demonstrates the "attach to `$scope`" style of controller. + * + * + * + *
+ * Name: + * [ greet ]
+ * Contact: + *
    + *
  • + * + * + * [ clear + * | X ] + *
  • + *
  • [ add ]
  • + *
+ *
+ *
+ * + * function SettingsController2($scope) { + * $scope.name = "John Smith"; + * $scope.contacts = [ + * {type:'phone', value:'408 555 1212'}, + * {type:'email', value:'john.smith@example.org'} ]; + * + * $scope.greet = function() { + * alert($scope.name); + * }; + * + * $scope.addContact = function() { + * $scope.contacts.push({type:'email', value:'yourname@example.org'}); + * }; + * + * $scope.removeContact = function(contactToRemove) { + * var index = $scope.contacts.indexOf(contactToRemove); + * $scope.contacts.splice(index, 1); + * }; + * + * $scope.clearContact = function(contact) { + * contact.type = 'phone'; + * contact.value = ''; + * }; + * } + * + * + * it('should check controller', function() { + * var container = element(by.id('ctrl-exmpl')); + * + * expect(container.findElement(by.model('name')) + * .getAttribute('value')).toBe('John Smith'); + * + * var firstRepeat = + * container.findElement(by.repeater('contact in contacts').row(0)); + * var secondRepeat = + * container.findElement(by.repeater('contact in contacts').row(1)); + * + * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe('408 555 1212'); + * expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe('john.smith@example.org'); + * + * firstRepeat.findElement(by.linkText('clear')).click(); + * + * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value')) + * .toBe(''); + * + * container.findElement(by.linkText('add')).click(); + * + * expect(container.findElement(by.repeater('contact in contacts').row(2)) + * .findElement(by.model('contact.value')) + * .getAttribute('value')) + * .toBe('yourname@example.org'); + * }); + * + *
*/ var ngControllerDirective = [function() { @@ -17912,7 +18747,7 @@ var ngControllerDirective = [function() { /** * @ngdoc directive - * @name ng.directive:ngCsp + * @name ngCsp * * @element html * @description @@ -17939,13 +18774,13 @@ var ngControllerDirective = [function() { * * @example * This example shows how to apply the `ngCsp` directive to the `html` tag. -
+   ```html
      
      
      ...
      ...
      
-   
+ ``` */ // ngCsp is not implemented as a proper directive any more, because we need it be processed while we bootstrap @@ -17954,7 +18789,7 @@ var ngControllerDirective = [function() { /** * @ngdoc directive - * @name ng.directive:ngClick + * @name ngClick * * @description * The ngClick directive allows you to specify custom behavior when @@ -17963,24 +18798,24 @@ var ngControllerDirective = [function() { * @element ANY * @priority 0 * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon - * click. (Event object is available as `$event`) + * click. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - +
+ it('should check ng-click', function() { expect(element(by.binding('count')).getText()).toMatch('0'); - element(by.css('.doc-example-live button')).click(); + element(by.css('button')).click(); expect(element(by.binding('count')).getText()).toMatch('1'); }); - - + + */ /* * A directive that allows creation of custom onclick handlers that are defined as angular @@ -18012,7 +18847,7 @@ forEach( /** * @ngdoc directive - * @name ng.directive:ngDblclick + * @name ngDblclick * * @description * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event. @@ -18023,20 +18858,20 @@ forEach( * a dblclick. (The Event object is available as `$event`) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMousedown + * @name ngMousedown * * @description * The ngMousedown directive allows you to specify custom behavior on mousedown event. @@ -18044,23 +18879,23 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon - * mousedown. (Event object is available as `$event`) + * mousedown. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMouseup + * @name ngMouseup * * @description * Specify custom behavior on mouseup event. @@ -18068,22 +18903,22 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon - * mouseup. (Event object is available as `$event`) + * mouseup. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMouseover + * @name ngMouseover * * @description * Specify custom behavior on mouseover event. @@ -18091,23 +18926,23 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon - * mouseover. (Event object is available as `$event`) + * mouseover. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMouseenter + * @name ngMouseenter * * @description * Specify custom behavior on mouseenter event. @@ -18115,23 +18950,23 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon - * mouseenter. (Event object is available as `$event`) + * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMouseleave + * @name ngMouseleave * * @description * Specify custom behavior on mouseleave event. @@ -18139,23 +18974,23 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon - * mouseleave. (Event object is available as `$event`) + * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngMousemove + * @name ngMousemove * * @description * Specify custom behavior on mousemove event. @@ -18163,23 +18998,23 @@ forEach( * @element ANY * @priority 0 * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon - * mousemove. (Event object is available as `$event`) + * mousemove. ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngKeydown + * @name ngKeydown * * @description * Specify custom behavior on keydown event. @@ -18190,18 +19025,18 @@ forEach( * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) * * @example - - + + key down count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngKeyup + * @name ngKeyup * * @description * Specify custom behavior on keyup event. @@ -18212,62 +19047,69 @@ forEach( * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) * * @example - - - - key up count: {{count}} - - + + +

Typing in the input box below updates the key count

+ key up count: {{count}} + +

Typing in the input box below updates the keycode

+ +

event keyCode: {{ event.keyCode }}

+

event altKey: {{ event.altKey }}

+
+
*/ /** * @ngdoc directive - * @name ng.directive:ngKeypress + * @name ngKeypress * * @description * Specify custom behavior on keypress event. * * @element ANY * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon - * keypress. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) + * keypress. ({@link guide/expression#-event- Event object is available as `$event`} + * and can be interrogated for keyCode, altKey, etc.) * * @example - - + + key press count: {{count}} - - + + */ /** * @ngdoc directive - * @name ng.directive:ngSubmit + * @name ngSubmit * * @description * Enables binding angular expressions to onsubmit events. * * Additionally it prevents the default action (which for form means sending the request to the - * server and reloading the current page) **but only if the form does not contain an `action` - * attribute**. + * server and reloading the current page), but only if the form does not contain `action`, + * `data-action`, or `x-action` attributes. * * @element form * @priority 0 - * @param {expression} ngSubmit {@link guide/expression Expression} to eval. (Event object is available as `$event`) + * @param {expression} ngSubmit {@link guide/expression Expression} to eval. + * ({@link guide/expression#-event- Event object is available as `$event`}) * * @example - - + + Load inlined template
-
- + + it('should load template defined inside script tag', function() { element(by.css('#tpl-link')).click(); expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/); }); - -
+ + */ var scriptDirective = ['$templateCache', function($templateCache) { return { @@ -20151,7 +21015,7 @@ var scriptDirective = ['$templateCache', function($templateCache) { var ngOptionsMinErr = minErr('ngOptions'); /** * @ngdoc directive - * @name ng.directive:select + * @name select * @restrict E * * @description @@ -20169,7 +21033,7 @@ var ngOptionsMinErr = minErr('ngOptions'); * *
* **Note:** `ngModel` compares by reference, not value. This is important when binding to an - * array of objects. See an example {@link http://jsfiddle.net/qWzTb/ in this jsfiddle}. + * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/). *
* * Optionally, a single hard-coded `