From 19eee06b5772ff6f9ff4adde5d3ae618b360fdd6 Mon Sep 17 00:00:00 2001 From: Chris Chua Date: Sat, 21 Dec 2013 15:34:01 -0800 Subject: [PATCH 1/5] chore(demo): update demo to include animations --- misc/demo/assets/app.js | 2 +- misc/demo/index.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/misc/demo/assets/app.js b/misc/demo/assets/app.js index 93101bdf4e..84fa7cc4d3 100644 --- a/misc/demo/assets/app.js +++ b/misc/demo/assets/app.js @@ -1,4 +1,4 @@ -angular.module('bootstrapDemoApp', ['ui.bootstrap', 'plunker', 'ngTouch'], function($httpProvider){ +angular.module('bootstrapDemoApp', ['ui.bootstrap', 'plunker', 'ngTouch', 'ngAnimate'], function($httpProvider){ FastClick.attach(document.body); delete $httpProvider.defaults.headers.common['X-Requested-With']; }).run(['$location', function($location){ diff --git a/misc/demo/index.html b/misc/demo/index.html index c471c6b6bd..0a60dfb740 100644 --- a/misc/demo/index.html +++ b/misc/demo/index.html @@ -10,6 +10,7 @@ + From 4ec80661930502408e3317fbbae0c8ff127edde6 Mon Sep 17 00:00:00 2001 From: Chris Chua Date: Sat, 25 Jan 2014 16:51:28 -0800 Subject: [PATCH 2/5] refactor(carousel): use ngAnimate - move animation logic into animator This allows animation logic to be overridden through a decorator. --- src/carousel/carousel.js | 110 ++++++++++++++++++++++++----------- template/carousel/slide.html | 8 +-- 2 files changed, 77 insertions(+), 41 deletions(-) diff --git a/src/carousel/carousel.js b/src/carousel/carousel.js index 13ff8743c1..61b43c05aa 100644 --- a/src/carousel/carousel.js +++ b/src/carousel/carousel.js @@ -6,8 +6,10 @@ * AngularJS version of an image carousel. * */ -angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition']) -.controller('CarouselController', ['$scope', '$timeout', '$transition', function ($scope, $timeout, $transition) { +angular.module('ui.bootstrap.carousel', []) +.controller('CarouselController', [ + 'carouselAnimator', '$scope', '$timeout', +function (carouselAnimator , $scope , $timeout) { var self = this, slides = self.slides = $scope.slides = [], currentIndex = -1, @@ -22,52 +24,29 @@ angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition']) if (direction === undefined) { direction = nextIndex > currentIndex ? 'next' : 'prev'; } + if (nextSlide && nextSlide !== self.currentSlide) { - if ($scope.$currentTransition) { - $scope.$currentTransition.cancel(); - //Timeout so ng-class in template has time to fix classes for finished slide - $timeout(goNext); - } else { goNext(); - } } function goNext() { // Scope has been destroyed, stop here. if (destroyed) { return; } //If we have a slide to transition from and we have a transition type and we're allowed, go - if (self.currentSlide && angular.isString(direction) && !$scope.noTransition && nextSlide.$element) { - //We shouldn't do class manip in here, but it's the same weird thing bootstrap does. need to fix sometime - nextSlide.$element.addClass(direction); - var reflow = nextSlide.$element[0].offsetWidth; //force reflow - - //Set all other slides to stop doing their stuff for the new transition - angular.forEach(slides, function(slide) { - angular.extend(slide, {direction: '', entering: false, leaving: false, active: false}); + var next = nextSlide.$element, + current = self.currentSlide && self.currentSlide.$element; + if (current && angular.isString(direction) && !$scope.noTransition) { + $scope.$currentTransition = true; + carouselAnimator.setActive(next, current, direction, function () { + $scope.$currentTransition = false; }); - angular.extend(nextSlide, {direction: direction, active: true, entering: true}); - angular.extend(self.currentSlide||{}, {direction: direction, leaving: true}); - - $scope.$currentTransition = $transition(nextSlide.$element, {}); - //We have to create new pointers inside a closure since next & current will change - (function(next,current) { - $scope.$currentTransition.then( - function(){ transitionDone(next, current); }, - function(){ transitionDone(next, current); } - ); - }(nextSlide, self.currentSlide)); } else { - transitionDone(nextSlide, self.currentSlide); + carouselAnimator.setActiveNoAnimate(next, current); } self.currentSlide = nextSlide; currentIndex = nextIndex; //every time you change slides, reset the timer restartTimer(); } - function transitionDone(next, current) { - angular.extend(next, {direction: '', active: true, leaving: false, entering: false}); - angular.extend(current||{}, {direction: '', active: false, leaving: false, entering: false}); - $scope.$currentTransition = null; - } }; $scope.$on('$destroy', function () { destroyed = true; @@ -290,4 +269,67 @@ function CarouselDemoCtrl($scope) { }); } }; -}); +}) + +.factory('carouselAnimator', [ + '$animate', + function ($animate) { + + var carouselAnimator = { + classes: { + active: 'active', + next: 'next', + prev: 'prev', + nextDirection: 'left', + prevDirection: 'right' + }, + setActive: setActive, + setActiveNoAnimate: setActiveNoAnimate + }; + + return carouselAnimator; + + function setActive(slide, curSlide, direction, done) { + + var directionClass = carouselAnimator.classes[direction], + directionDirClass = carouselAnimator.classes[direction + 'Direction'], + animationWaitCount = 0; + + animationWaitCount++; + slide.addClass(directionClass); + $animate.addClass(slide, directionDirClass, function () { + slide.removeClass( directionDirClass + ' ' + direction ); + animationDone(); + }); + + if (curSlide) { + animationWaitCount++; + $animate.addClass(curSlide, directionDirClass, function () { + curSlide.removeClass(directionDirClass); + animationDone(); + }); + } + + function animationDone() { + if (!--animationWaitCount) { + setActiveNoAnimate(slide, curSlide); + if (done) { + done(); + } + } + } + } + + function setActiveNoAnimate(slide, curSlide) { + var activeClass = carouselAnimator.classes.active; + + slide.addClass(activeClass); + if (curSlide) { + curSlide.removeClass(activeClass); + } + } + + } +]) + +; diff --git a/template/carousel/slide.html b/template/carousel/slide.html index 451e4fba3e..14bf3e8e4b 100644 --- a/template/carousel/slide.html +++ b/template/carousel/slide.html @@ -1,7 +1 @@ -
+
From 2b8c8b093b8ceac0c23afb6d0ca2962102f24617 Mon Sep 17 00:00:00 2001 From: Chris Chua Date: Sun, 2 Mar 2014 18:15:00 -0800 Subject: [PATCH 3/5] test(carousel): fix tests Still assign to the active variable in the scope for now. --- src/carousel/carousel.js | 4 ++++ src/carousel/test/carousel.spec.js | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/carousel/carousel.js b/src/carousel/carousel.js index 61b43c05aa..462d936d6f 100644 --- a/src/carousel/carousel.js +++ b/src/carousel/carousel.js @@ -42,6 +42,10 @@ function (carouselAnimator , $scope , $timeout) { } else { carouselAnimator.setActiveNoAnimate(next, current); } + if (self.currentSlide) { + self.currentSlide.active = false; + } + nextSlide.active = true; self.currentSlide = nextSlide; currentIndex = nextIndex; //every time you change slides, reset the timer diff --git a/src/carousel/test/carousel.spec.js b/src/carousel/test/carousel.spec.js index 0bbb0916a7..ca13ea3f98 100644 --- a/src/carousel/test/carousel.spec.js +++ b/src/carousel/test/carousel.spec.js @@ -270,11 +270,16 @@ describe('carousel', function() { //create an array of slides and add to the scope var slides = [{'content':1},{'content':2},{'content':3},{'content':4}]; + /* carouselAnimator makes use of these class methods */ + function createElementNodeSpy() { + return jasmine.createSpyObj('element', ['addClass', 'removeClass']); + } + beforeEach(function() { scope = $rootScope.$new(); ctrl = $controller('CarouselController', {$scope: scope, $element: null}); for(var i = 0;i < slides.length;i++){ - ctrl.addSlide(slides[i]); + ctrl.addSlide(slides[i], createElementNodeSpy()); } }); @@ -292,7 +297,7 @@ describe('carousel', function() { it('should add new slide and change active to true if active is true on the added slide', function() { var newSlide = {active: true}; expect(ctrl.slides.length).toBe(4); - ctrl.addSlide(newSlide); + ctrl.addSlide(newSlide, createElementNodeSpy()); expect(ctrl.slides.length).toBe(5); expect(ctrl.slides[4].active).toBe(true); expect(ctrl.slides[0].active).toBe(false); @@ -301,7 +306,7 @@ describe('carousel', function() { it('should add a new slide and not change the active slide', function() { var newSlide = {active: false}; expect(ctrl.slides.length).toBe(4); - ctrl.addSlide(newSlide); + ctrl.addSlide(newSlide, createElementNodeSpy()); expect(ctrl.slides.length).toBe(5); expect(ctrl.slides[4].active).toBe(false); expect(ctrl.slides[0].active).toBe(true); From d42fb79a527c0cdc55e5a371b3a24c79340dfa37 Mon Sep 17 00:00:00 2001 From: Chris Chua Date: Mon, 3 Mar 2014 00:10:17 -0800 Subject: [PATCH 4/5] chore(ngVersion): update to 1.2.14 Need this because $animate.queue was added in 1.2.12 . --- Gruntfile.js | 2 +- misc/test-lib/angular-mocks.js | 375 ++- misc/test-lib/angular.js | 4223 ++++++++++++++++++-------------- 3 files changed, 2527 insertions(+), 2073 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index b8697a1837..f886c5089b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -16,7 +16,7 @@ module.exports = function(grunt) { grunt.util.linefeed = '\n'; grunt.initConfig({ - ngversion: '1.2.10', + ngversion: '1.2.14', bsversion: '3.0.3', modules: [],//to be filled in by build task pkg: grunt.file.readJSON('package.json'), diff --git a/misc/test-lib/angular-mocks.js b/misc/test-lib/angular-mocks.js index b367f3d60b..efd029bfdd 100644 --- a/misc/test-lib/angular-mocks.js +++ b/misc/test-lib/angular-mocks.js @@ -1,5 +1,5 @@ /** - * @license AngularJS v1.2.10 + * @license AngularJS v1.2.14 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ @@ -8,7 +8,7 @@ 'use strict'; /** - * @ngdoc overview + * @ngdoc object * @name angular.mock * @description * @@ -19,7 +19,7 @@ angular.mock = {}; /** * ! This is a private undocumented service ! * - * @name ngMock.$browser + * @name $browser * * @description * This service is a mock implementation of {@link ng.$browser}. It provides fake @@ -77,8 +77,7 @@ angular.mock.$Browser = function() { /** - * @name ngMock.$browser#defer.now - * @propertyOf ngMock.$browser + * @name $browser#defer.now * * @description * Current milliseconds mock time. @@ -103,8 +102,7 @@ angular.mock.$Browser = function() { /** - * @name ngMock.$browser#defer.flush - * @methodOf ngMock.$browser + * @name $browser#defer.flush * * @description * Flushes all pending requests and executes the defer callbacks. @@ -135,8 +133,7 @@ angular.mock.$Browser = function() { angular.mock.$Browser.prototype = { /** - * @name ngMock.$browser#poll - * @methodOf ngMock.$browser + * @name $browser#poll * * @description * run all fns in pollFns @@ -187,8 +184,8 @@ angular.mock.$Browser.prototype = { /** - * @ngdoc object - * @name ngMock.$exceptionHandlerProvider + * @ngdoc provider + * @name $exceptionHandlerProvider * * @description * Configures the mock implementation of {@link ng.$exceptionHandler} to rethrow or to log errors @@ -196,8 +193,8 @@ angular.mock.$Browser.prototype = { */ /** - * @ngdoc object - * @name ngMock.$exceptionHandler + * @ngdoc service + * @name $exceptionHandler * * @description * Mock implementation of {@link ng.$exceptionHandler} that rethrows or logs errors passed @@ -205,7 +202,7 @@ angular.mock.$Browser.prototype = { * information. * * - *
+ * ```js
  *   describe('$exceptionHandlerProvider', function() {
  *
  *     it('should capture log messages and exceptions', function() {
@@ -226,7 +223,7 @@ angular.mock.$Browser.prototype = {
  *       });
  *     });
  *   });
- * 
+ * ``` */ angular.mock.$ExceptionHandlerProvider = function() { @@ -234,8 +231,7 @@ angular.mock.$ExceptionHandlerProvider = function() { /** * @ngdoc method - * @name ngMock.$exceptionHandlerProvider#mode - * @methodOf ngMock.$exceptionHandlerProvider + * @name $exceptionHandlerProvider#mode * * @description * Sets the logging mode. @@ -285,7 +281,7 @@ angular.mock.$ExceptionHandlerProvider = function() { /** * @ngdoc service - * @name ngMock.$log + * @name $log * * @description * Mock implementation of {@link ng.$log} that gathers all logged messages in arrays @@ -324,8 +320,7 @@ angular.mock.$LogProvider = function() { /** * @ngdoc method - * @name ngMock.$log#reset - * @methodOf ngMock.$log + * @name $log#reset * * @description * Reset all of the logging arrays to empty. @@ -333,85 +328,79 @@ angular.mock.$LogProvider = function() { $log.reset = function () { /** * @ngdoc property - * @name ngMock.$log#log.logs - * @propertyOf ngMock.$log + * @name $log#log.logs * * @description * Array of messages logged using {@link ngMock.$log#log}. * * @example - *
+       * ```js
        * $log.log('Some Log');
        * var first = $log.log.logs.unshift();
-       * 
+ * ``` */ $log.log.logs = []; /** * @ngdoc property - * @name ngMock.$log#info.logs - * @propertyOf ngMock.$log + * @name $log#info.logs * * @description * Array of messages logged using {@link ngMock.$log#info}. * * @example - *
+       * ```js
        * $log.info('Some Info');
        * var first = $log.info.logs.unshift();
-       * 
+ * ``` */ $log.info.logs = []; /** * @ngdoc property - * @name ngMock.$log#warn.logs - * @propertyOf ngMock.$log + * @name $log#warn.logs * * @description * Array of messages logged using {@link ngMock.$log#warn}. * * @example - *
+       * ```js
        * $log.warn('Some Warning');
        * var first = $log.warn.logs.unshift();
-       * 
+ * ``` */ $log.warn.logs = []; /** * @ngdoc property - * @name ngMock.$log#error.logs - * @propertyOf ngMock.$log + * @name $log#error.logs * * @description * Array of messages logged using {@link ngMock.$log#error}. * * @example - *
+       * ```js
        * $log.error('Some Error');
        * var first = $log.error.logs.unshift();
-       * 
+ * ``` */ $log.error.logs = []; /** * @ngdoc property - * @name ngMock.$log#debug.logs - * @propertyOf ngMock.$log + * @name $log#debug.logs * * @description * Array of messages logged using {@link ngMock.$log#debug}. * * @example - *
+       * ```js
        * $log.debug('Some Error');
        * var first = $log.debug.logs.unshift();
-       * 
+ * ``` */ $log.debug.logs = []; }; /** * @ngdoc method - * @name ngMock.$log#assertEmpty - * @methodOf ngMock.$log + * @name $log#assertEmpty * * @description * Assert that the all of the logging methods have no logged messages. If messages present, an @@ -443,12 +432,12 @@ angular.mock.$LogProvider = function() { /** * @ngdoc service - * @name ngMock.$interval + * @name $interval * * @description * Mock implementation of the $interval service. * - * Use {@link ngMock.$interval#methods_flush `$interval.flush(millis)`} to + * Use {@link ngMock.$interval#flush `$interval.flush(millis)`} to * move forward by `millis` milliseconds and trigger any functions scheduled to run in that * time. * @@ -457,7 +446,7 @@ angular.mock.$LogProvider = function() { * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat * indefinitely. * @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} A promise which will be notified on each iteration. */ angular.mock.$IntervalProvider = function() { @@ -509,8 +498,18 @@ angular.mock.$IntervalProvider = function() { nextRepeatId++; return promise; }; - + /** + * @ngdoc method + * @name $interval#cancel + * + * @description + * Cancels a task associated with the `promise`. + * + * @param {number} promise A promise from calling the `$interval` function. + * @returns {boolean} Returns `true` if the task was successfully cancelled. + */ $interval.cancel = function(promise) { + if(!promise) return false; var fnIndex; angular.forEach(repeatFns, function(fn, index) { @@ -528,8 +527,7 @@ angular.mock.$IntervalProvider = function() { /** * @ngdoc method - * @name ngMock.$interval#flush - * @methodOf ngMock.$interval + * @name $interval#flush * @description * * Runs interval tasks scheduled to be run in the next `millis` milliseconds. @@ -600,7 +598,7 @@ function padNumber(num, digits, trim) { /** - * @ngdoc object + * @ngdoc type * @name angular.mock.TzDate * @description * @@ -624,7 +622,7 @@ function padNumber(num, digits, trim) { * incomplete we might be missing some non-standard methods. This can result in errors like: * "Date.prototype.foo called on incompatible Object". * - *
+ * ```js
  * var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00Z');
  * newYearInBratislava.getTimezoneOffset() => -60;
  * newYearInBratislava.getFullYear() => 2010;
@@ -633,7 +631,7 @@ function padNumber(num, digits, trim) {
  * newYearInBratislava.getHours() => 0;
  * newYearInBratislava.getMinutes() => 0;
  * newYearInBratislava.getSeconds() => 0;
- * 
+ * ``` * */ angular.mock.TzDate = function (offset, timestamp) { @@ -763,70 +761,43 @@ angular.mock.TzDate = function (offset, timestamp) { angular.mock.TzDate.prototype = Date.prototype; /* jshint +W101 */ -// TODO(matias): remove this IMMEDIATELY once we can properly detect the -// presence of a registered module -var animateLoaded; -try { - angular.module('ngAnimate'); - animateLoaded = true; -} catch(e) {} +angular.mock.animate = angular.module('ngAnimateMock', ['ng']) + + .config(['$provide', function($provide) { -if(animateLoaded) { - angular.module('ngAnimate').config(['$provide', function($provide) { var reflowQueue = []; $provide.value('$$animateReflow', function(fn) { + var index = reflowQueue.length; reflowQueue.push(fn); - return angular.noop; - }); - $provide.decorator('$animate', function($delegate) { - $delegate.triggerReflow = function() { - if(reflowQueue.length === 0) { - throw new Error('No animation reflows present'); - } - angular.forEach(reflowQueue, function(fn) { - fn(); - }); - reflowQueue = []; + return function cancel() { + reflowQueue.splice(index, 1); }; - return $delegate; }); - }]); -} - -angular.mock.animate = angular.module('mock.animate', ['ng']) - .config(['$provide', function($provide) { - - $provide.decorator('$animate', function($delegate) { + $provide.decorator('$animate', function($delegate, $$asyncCallback) { var animate = { queue : [], enabled : $delegate.enabled, - flushNext : function(name) { - var tick = animate.queue.shift(); - - if (!tick) throw new Error('No animation to be flushed'); - if(tick.method !== name) { - throw new Error('The next animation is not "' + name + - '", but is "' + tick.method + '"'); - } - tick.fn(); - return tick; + triggerCallbacks : function() { + $$asyncCallback.flush(); + }, + triggerReflow : function() { + angular.forEach(reflowQueue, function(fn) { + fn(); + }); + reflowQueue = []; } }; - angular.forEach(['enter','leave','move','addClass','removeClass'], function(method) { + angular.forEach( + ['enter','leave','move','addClass','removeClass','setClass'], function(method) { animate[method] = function() { - var params = arguments; animate.queue.push({ - method : method, - params : params, - element : angular.isElement(params[0]) && params[0], - parent : angular.isElement(params[1]) && params[1], - after : angular.isElement(params[2]) && params[2], - fn : function() { - $delegate[method].apply($delegate, params); - } + event : method, + element : arguments[0], + args : arguments }); + $delegate[method].apply($delegate, arguments); }; }); @@ -907,8 +878,8 @@ angular.mock.dump = function(object) { }; /** - * @ngdoc object - * @name ngMock.$httpBackend + * @ngdoc service + * @name $httpBackend * @description * Fake HTTP backend implementation suitable for unit testing applications that use the * {@link ng.$http $http service}. @@ -917,8 +888,8 @@ angular.mock.dump = function(object) { * development please see {@link ngMockE2E.$httpBackend e2e $httpBackend mock}. * * During unit testing, we want our unit tests to run quickly and have no external dependencies so - * we don’t want to send {@link https://developer.mozilla.org/en/xmlhttprequest XHR} or - * {@link http://en.wikipedia.org/wiki/JSONP JSONP} requests to a real server. All we really need is + * we don’t want to send [XHR](https://developer.mozilla.org/en/xmlhttprequest) or + * [JSONP](http://en.wikipedia.org/wiki/JSONP) requests to a real server. All we really need is * to verify whether a certain request has been sent or not, or alternatively just let the * application make requests, respond with pre-trained responses and assert that the end result is * what we expect it to be. @@ -996,20 +967,20 @@ angular.mock.dump = function(object) { * * # Flushing HTTP requests * - * The $httpBackend used in production, always responds to requests with responses asynchronously. - * If we preserved this behavior in unit testing, we'd have to create async unit tests, which are - * hard to write, follow and maintain. At the same time the testing mock, can't respond + * The $httpBackend used in production always responds to requests with responses asynchronously. + * If we preserved this behavior in unit testing we'd have to create async unit tests, which are + * hard to write, understand, and maintain. However, the testing mock can't respond * synchronously because that would change the execution of the code under test. For this reason the * mock $httpBackend has a `flush()` method, which allows the test to explicitly flush pending - * requests and thus preserving the async api of the backend, while allowing the test to execute + * requests and thus preserve the async api of the backend while allowing the test to execute * synchronously. * * * # Unit testing with mock $httpBackend - * The following code shows how to setup and use the mock backend in unit testing a controller. - * First we create the controller under test + * The following code shows how to setup and use the mock backend when unit testing a controller. + * First we create the controller under test: * -
+  ```js
   // The controller code
   function MyController($scope, $http) {
     var authToken;
@@ -1030,11 +1001,11 @@ angular.mock.dump = function(object) {
       });
     };
   }
-  
+ ``` * - * Now we setup the mock backend and create the test specs. + * Now we setup the mock backend and create the test specs: * -
+  ```js
     // testing controller
     describe('MyController', function() {
        var $httpBackend, $rootScope, createController;
@@ -1100,7 +1071,7 @@ angular.mock.dump = function(object) {
          $httpBackend.flush();
        });
     });
-   
+ ``` */ angular.mock.$HttpBackendProvider = function() { this.$get = ['$rootScope', createHttpBackendMock]; @@ -1210,8 +1181,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#when - * @methodOf ngMock.$httpBackend + * @name $httpBackend#when * @description * Creates a new backend definition. * @@ -1250,8 +1220,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#whenGET - * @methodOf ngMock.$httpBackend + * @name $httpBackend#whenGET * @description * Creates a new backend definition for GET requests. For more info see `when()`. * @@ -1263,8 +1232,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#whenHEAD - * @methodOf ngMock.$httpBackend + * @name $httpBackend#whenHEAD * @description * Creates a new backend definition for HEAD requests. For more info see `when()`. * @@ -1276,8 +1244,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#whenDELETE - * @methodOf ngMock.$httpBackend + * @name $httpBackend#whenDELETE * @description * Creates a new backend definition for DELETE requests. For more info see `when()`. * @@ -1289,8 +1256,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#whenPOST - * @methodOf ngMock.$httpBackend + * @name $httpBackend#whenPOST * @description * Creates a new backend definition for POST requests. For more info see `when()`. * @@ -1304,8 +1270,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#whenPUT - * @methodOf ngMock.$httpBackend + * @name $httpBackend#whenPUT * @description * Creates a new backend definition for PUT requests. For more info see `when()`. * @@ -1319,8 +1284,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#whenJSONP - * @methodOf ngMock.$httpBackend + * @name $httpBackend#whenJSONP * @description * Creates a new backend definition for JSONP requests. For more info see `when()`. * @@ -1333,8 +1297,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#expect - * @methodOf ngMock.$httpBackend + * @name $httpBackend#expect * @description * Creates a new request expectation. * @@ -1367,8 +1330,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#expectGET - * @methodOf ngMock.$httpBackend + * @name $httpBackend#expectGET * @description * Creates a new request expectation for GET requests. For more info see `expect()`. * @@ -1380,8 +1342,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#expectHEAD - * @methodOf ngMock.$httpBackend + * @name $httpBackend#expectHEAD * @description * Creates a new request expectation for HEAD requests. For more info see `expect()`. * @@ -1393,8 +1354,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#expectDELETE - * @methodOf ngMock.$httpBackend + * @name $httpBackend#expectDELETE * @description * Creates a new request expectation for DELETE requests. For more info see `expect()`. * @@ -1406,8 +1366,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#expectPOST - * @methodOf ngMock.$httpBackend + * @name $httpBackend#expectPOST * @description * Creates a new request expectation for POST requests. For more info see `expect()`. * @@ -1422,8 +1381,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#expectPUT - * @methodOf ngMock.$httpBackend + * @name $httpBackend#expectPUT * @description * Creates a new request expectation for PUT requests. For more info see `expect()`. * @@ -1438,8 +1396,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#expectPATCH - * @methodOf ngMock.$httpBackend + * @name $httpBackend#expectPATCH * @description * Creates a new request expectation for PATCH requests. For more info see `expect()`. * @@ -1454,8 +1411,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#expectJSONP - * @methodOf ngMock.$httpBackend + * @name $httpBackend#expectJSONP * @description * Creates a new request expectation for JSONP requests. For more info see `expect()`. * @@ -1468,8 +1424,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#flush - * @methodOf ngMock.$httpBackend + * @name $httpBackend#flush * @description * Flushes all pending requests using the trained responses. * @@ -1497,8 +1452,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#verifyNoOutstandingExpectation - * @methodOf ngMock.$httpBackend + * @name $httpBackend#verifyNoOutstandingExpectation * @description * Verifies that all of the requests defined via the `expect` api were made. If any of the * requests were not made, verifyNoOutstandingExpectation throws an exception. @@ -1506,9 +1460,9 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { * Typically, you would call this method following each test case that asserts requests using an * "afterEach" clause. * - *
+   * ```js
    *   afterEach($httpBackend.verifyNoOutstandingExpectation);
-   * 
+ * ``` */ $httpBackend.verifyNoOutstandingExpectation = function() { $rootScope.$digest(); @@ -1520,17 +1474,16 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#verifyNoOutstandingRequest - * @methodOf ngMock.$httpBackend + * @name $httpBackend#verifyNoOutstandingRequest * @description * Verifies that there are no outstanding requests that need to be flushed. * * Typically, you would call this method following each test case that asserts requests using an * "afterEach" clause. * - *
+   * ```js
    *   afterEach($httpBackend.verifyNoOutstandingRequest);
-   * 
+ * ``` */ $httpBackend.verifyNoOutstandingRequest = function() { if (responses.length) { @@ -1541,8 +1494,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { /** * @ngdoc method - * @name ngMock.$httpBackend#resetExpectations - * @methodOf ngMock.$httpBackend + * @name $httpBackend#resetExpectations * @description * Resets all request expectations, but preserves all backend definitions. Typically, you would * call resetExpectations during a multiple-phase test when you want to reuse the same instance of @@ -1665,8 +1617,8 @@ function MockXhr() { /** - * @ngdoc function - * @name ngMock.$timeout + * @ngdoc service + * @name $timeout * @description * * This service is just a simple decorator for {@link ng.$timeout $timeout} service @@ -1677,8 +1629,7 @@ angular.mock.$TimeoutDecorator = function($delegate, $browser) { /** * @ngdoc method - * @name ngMock.$timeout#flush - * @methodOf ngMock.$timeout + * @name $timeout#flush * @description * * Flushes the queue of pending tasks. @@ -1691,8 +1642,7 @@ angular.mock.$TimeoutDecorator = function($delegate, $browser) { /** * @ngdoc method - * @name ngMock.$timeout#verifyNoPendingTasks - * @methodOf ngMock.$timeout + * @name $timeout#verifyNoPendingTasks * @description * * Verifies that there are no pending tasks that need to be flushed. @@ -1716,6 +1666,48 @@ angular.mock.$TimeoutDecorator = function($delegate, $browser) { return $delegate; }; +angular.mock.$RAFDecorator = function($delegate) { + var queue = []; + var rafFn = function(fn) { + var index = queue.length; + queue.push(fn); + return function() { + queue.splice(index, 1); + }; + }; + + rafFn.supported = $delegate.supported; + + rafFn.flush = function() { + if(queue.length === 0) { + throw new Error('No rAF callbacks present'); + } + + var length = queue.length; + for(var i=0;i * @@ -1750,11 +1741,14 @@ angular.module('ngMock', ['ng']).provider({ $rootElement: angular.mock.$RootElementProvider }).config(['$provide', function($provide) { $provide.decorator('$timeout', angular.mock.$TimeoutDecorator); + $provide.decorator('$$rAF', angular.mock.$RAFDecorator); + $provide.decorator('$$asyncCallback', angular.mock.$AsyncCallbackDecorator); }]); /** - * @ngdoc overview + * @ngdoc module * @name ngMockE2E + * @module ngMockE2E * @description * * The `ngMockE2E` is an angular module which contains mocks suitable for end-to-end testing. @@ -1766,8 +1760,9 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { }]); /** - * @ngdoc object - * @name ngMockE2E.$httpBackend + * @ngdoc service + * @name $httpBackend + * @module ngMockE2E * @description * Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of * applications that use the {@link ng.$http $http service}. @@ -1793,7 +1788,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { * To setup the application to run with this http backend, you have to create a module that depends * on the `ngMockE2E` and your application modules and defines the fake backend: * - *
+ * ```js
  *   myAppDev = angular.module('myAppDev', ['myApp', 'ngMockE2E']);
  *   myAppDev.run(function($httpBackend) {
  *     phones = [{name: 'phone1'}, {name: 'phone2'}];
@@ -1808,15 +1803,15 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
  *     $httpBackend.whenGET(/^\/templates\//).passThrough();
  *     //...
  *   });
- * 
+ * ``` * * Afterwards, bootstrap your app with this new module. */ /** * @ngdoc method - * @name ngMockE2E.$httpBackend#when - * @methodOf ngMockE2E.$httpBackend + * @name $httpBackend#when + * @module ngMockE2E * @description * Creates a new backend definition. * @@ -1840,8 +1835,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { /** * @ngdoc method - * @name ngMockE2E.$httpBackend#whenGET - * @methodOf ngMockE2E.$httpBackend + * @name $httpBackend#whenGET + * @module ngMockE2E * @description * Creates a new backend definition for GET requests. For more info see `when()`. * @@ -1853,8 +1848,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { /** * @ngdoc method - * @name ngMockE2E.$httpBackend#whenHEAD - * @methodOf ngMockE2E.$httpBackend + * @name $httpBackend#whenHEAD + * @module ngMockE2E * @description * Creates a new backend definition for HEAD requests. For more info see `when()`. * @@ -1866,8 +1861,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { /** * @ngdoc method - * @name ngMockE2E.$httpBackend#whenDELETE - * @methodOf ngMockE2E.$httpBackend + * @name $httpBackend#whenDELETE + * @module ngMockE2E * @description * Creates a new backend definition for DELETE requests. For more info see `when()`. * @@ -1879,8 +1874,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { /** * @ngdoc method - * @name ngMockE2E.$httpBackend#whenPOST - * @methodOf ngMockE2E.$httpBackend + * @name $httpBackend#whenPOST + * @module ngMockE2E * @description * Creates a new backend definition for POST requests. For more info see `when()`. * @@ -1893,8 +1888,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { /** * @ngdoc method - * @name ngMockE2E.$httpBackend#whenPUT - * @methodOf ngMockE2E.$httpBackend + * @name $httpBackend#whenPUT + * @module ngMockE2E * @description * Creates a new backend definition for PUT requests. For more info see `when()`. * @@ -1907,8 +1902,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { /** * @ngdoc method - * @name ngMockE2E.$httpBackend#whenPATCH - * @methodOf ngMockE2E.$httpBackend + * @name $httpBackend#whenPATCH + * @module ngMockE2E * @description * Creates a new backend definition for PATCH requests. For more info see `when()`. * @@ -1921,8 +1916,8 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) { /** * @ngdoc method - * @name ngMockE2E.$httpBackend#whenJSONP - * @methodOf ngMockE2E.$httpBackend + * @name $httpBackend#whenJSONP + * @module ngMockE2E * @description * Creates a new backend definition for JSONP requests. For more info see `when()`. * @@ -1954,7 +1949,7 @@ if(window.jasmine || window.mocha) { var currentSpec = null, isSpecRunning = function() { - return currentSpec && (window.mocha || currentSpec.queue.running); + return !!currentSpec; }; @@ -2039,7 +2034,7 @@ if(window.jasmine || window.mocha) { * *NOTE*: This function is also published on window for easy access.
* * The inject function wraps a function into an injectable function. The inject() creates new - * instance of {@link AUTO.$injector $injector} per test, which is then used for + * instance of {@link auto.$injector $injector} per test, which is then used for * resolving references. * * @@ -2077,7 +2072,7 @@ if(window.jasmine || window.mocha) { * * ## Example * Example of what a typical jasmine tests looks like with the inject method. - *
+   * ```js
    *
    *   angular.module('myApplicationModule', [])
    *       .value('mode', 'app')
@@ -2111,7 +2106,7 @@ if(window.jasmine || window.mocha) {
    *     });
    *   });
    *
-   * 
+ * ``` * * @param {...Function} fns any number of functions which will be injected using the injector. */ @@ -2132,7 +2127,7 @@ if(window.jasmine || window.mocha) { window.inject = angular.mock.inject = function() { var blockFns = Array.prototype.slice.call(arguments, 0); var errorForStack = new Error('Declaration Location'); - return isSpecRunning() ? workFn() : workFn; + return isSpecRunning() ? workFn.call(currentSpec) : workFn; ///////////////////// function workFn() { var modules = currentSpec.$modules || []; diff --git a/misc/test-lib/angular.js b/misc/test-lib/angular.js index b8621a9a2d..83146684bf 100644 --- a/misc/test-lib/angular.js +++ b/misc/test-lib/angular.js @@ -1,5 +1,5 @@ /** - * @license AngularJS v1.2.10 + * @license AngularJS v1.2.14 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ @@ -30,7 +30,7 @@ * should all be static strings, not variables or general expressions. * * @param {string} module The namespace to use for the new minErr instance. - * @returns {function(string, string, ...): Error} instance + * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance */ function minErr(module) { @@ -68,7 +68,7 @@ function minErr(module) { return match; }); - message = message + '\nhttp://errors.angularjs.org/1.2.10/' + + message = message + '\nhttp://errors.angularjs.org/1.2.14/' + (module ? module + '/' : '') + code; for (i = 2; i < arguments.length; i++) { message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' + @@ -160,14 +160,31 @@ function minErr(module) { -assertNotHasOwnProperty, -getter, -getBlockElements, + -hasOwnProperty, */ //////////////////////////////////// +/** + * @ngdoc module + * @name ng + * @module ng + * @description + * + * # ng (core module) + * The ng module is loaded by default when an AngularJS application is started. The module itself + * contains the essential components for an AngularJS application to function. The table below + * lists a high level breakdown of each of the services/factories, filters, directives and testing + * components available within this core module. + * + *
+ */ + /** * @ngdoc function * @name angular.lowercase + * @module ng * @function * * @description Converts the specified string to lowercase. @@ -175,11 +192,12 @@ function minErr(module) { * @returns {string} Lowercased string. */ var lowercase = function(string){return isString(string) ? string.toLowerCase() : string;}; - +var hasOwnProperty = Object.prototype.hasOwnProperty; /** * @ngdoc function * @name angular.uppercase + * @module ng * @function * * @description Converts the specified string to uppercase. @@ -263,6 +281,7 @@ function isArrayLike(obj) { /** * @ngdoc function * @name angular.forEach + * @module ng * @function * * @description @@ -271,17 +290,17 @@ function isArrayLike(obj) { * is the value of an object property or an array element and `key` is the object property key or * array element index. Specifying a `context` for the function is optional. * - * It is worth nothing that `.forEach` does not iterate over inherited properties because it filters + * It is worth noting that `.forEach` does not iterate over inherited properties because it filters * using the `hasOwnProperty` method. * -
+   ```js
      var values = {name: 'misko', gender: 'male'};
      var log = [];
      angular.forEach(values, function(value, key){
        this.push(key + ': ' + value);
      }, log);
-     expect(log).toEqual(['name: misko', 'gender:male']);
-   
+ expect(log).toEqual(['name: misko', 'gender: male']); + ``` * * @param {Object|Array} obj Object to iterate over. * @param {Function} iterator Iterator function. @@ -349,7 +368,7 @@ function reverseParams(iteratorFn) { * the number string gets longer over time, and it can also overflow, where as the nextId * will grow much slower, it is a string, and it will never overflow. * - * @returns an unique alpha-numeric string + * @returns {string} an unique alpha-numeric string */ function nextUid() { var index = uid.length; @@ -391,6 +410,7 @@ function setHashKey(obj, h) { /** * @ngdoc function * @name angular.extend + * @module ng * @function * * @description @@ -427,17 +447,18 @@ function inherit(parent, extra) { /** * @ngdoc function * @name angular.noop + * @module ng * @function * * @description * A function that performs no operations. This function can be useful when writing code in the * functional style. -
+   ```js
      function foo(callback) {
        var result = calculateResult();
        (callback || angular.noop)(result);
      }
-   
+ ``` */ function noop() {} noop.$inject = []; @@ -446,17 +467,18 @@ noop.$inject = []; /** * @ngdoc function * @name angular.identity + * @module ng * @function * * @description * A function that returns its first argument. This function is useful when writing code in the * functional style. * -
+   ```js
      function transformer(transformationFn, value) {
        return (transformationFn || angular.identity)(value);
      };
-   
+ ``` */ function identity($) {return $;} identity.$inject = []; @@ -467,6 +489,7 @@ function valueFn(value) {return function() {return value;};} /** * @ngdoc function * @name angular.isUndefined + * @module ng * @function * * @description @@ -481,6 +504,7 @@ function isUndefined(value){return typeof value === 'undefined';} /** * @ngdoc function * @name angular.isDefined + * @module ng * @function * * @description @@ -495,11 +519,12 @@ function isDefined(value){return typeof value !== 'undefined';} /** * @ngdoc function * @name angular.isObject + * @module ng * @function * * @description * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not - * considered to be objects. + * considered to be objects. Note that JavaScript arrays are objects. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is an `Object` but not `null`. @@ -510,6 +535,7 @@ function isObject(value){return value != null && typeof value === 'object';} /** * @ngdoc function * @name angular.isString + * @module ng * @function * * @description @@ -524,6 +550,7 @@ function isString(value){return typeof value === 'string';} /** * @ngdoc function * @name angular.isNumber + * @module ng * @function * * @description @@ -538,6 +565,7 @@ function isNumber(value){return typeof value === 'number';} /** * @ngdoc function * @name angular.isDate + * @module ng * @function * * @description @@ -554,6 +582,7 @@ function isDate(value){ /** * @ngdoc function * @name angular.isArray + * @module ng * @function * * @description @@ -570,6 +599,7 @@ function isArray(value) { /** * @ngdoc function * @name angular.isFunction + * @module ng * @function * * @description @@ -638,6 +668,7 @@ var trim = (function() { /** * @ngdoc function * @name angular.isElement + * @module ng * @function * * @description @@ -649,7 +680,7 @@ var trim = (function() { function isElement(node) { return !!(node && (node.nodeName // we are a direct element - || (node.on && node.find))); // we have an on and find method part of jQuery API + || (node.prop && node.attr && node.find))); // we have an on and find method part of jQuery API } /** @@ -748,6 +779,7 @@ function isLeafNode (node) { /** * @ngdoc function * @name angular.copy + * @module ng * @function * * @description @@ -766,8 +798,8 @@ function isLeafNode (node) { * @returns {*} The copy or updated `destination`, if `destination` was specified. * * @example - - + +
Name:
@@ -798,8 +830,8 @@ function isLeafNode (node) { $scope.reset(); } - - + + */ function copy(source, destination){ if (isWindow(source) || isScope(source)) { @@ -851,7 +883,7 @@ function shallowCopy(src, dst) { for(var key in src) { // shallowCopy is only ever called by $compile nodeLinkFn, which has control over src // so we don't need to worry about using our custom hasOwnProperty here - if (src.hasOwnProperty(key) && key.charAt(0) !== '$' && key.charAt(1) !== '$') { + if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) { dst[key] = src[key]; } } @@ -863,6 +895,7 @@ function shallowCopy(src, dst) { /** * @ngdoc function * @name angular.equals + * @module ng * @function * * @description @@ -949,6 +982,7 @@ function sliceArgs(args, startIndex) { /** * @ngdoc function * @name angular.bind + * @module ng * @function * * @description @@ -1004,6 +1038,7 @@ function toJsonReplacer(key, value) { /** * @ngdoc function * @name angular.toJson + * @module ng * @function * * @description @@ -1023,13 +1058,14 @@ function toJson(obj, pretty) { /** * @ngdoc function * @name angular.fromJson + * @module ng * @function * * @description * Deserializes a JSON string. * * @param {string} json JSON string to deserialize. - * @returns {Object|Array|Date|string|number} Deserialized thingy. + * @returns {Object|Array|string|number} Deserialized thingy. */ function fromJson(json) { return isString(json) @@ -1096,7 +1132,7 @@ function tryDecodeURIComponent(value) { /** * Parses an escaped url query string into key-value pairs. - * @returns Object.<(string|boolean)> + * @returns {Object.} */ function parseKeyValue(/**string*/keyValue) { var obj = {}, key_value, key; @@ -1178,7 +1214,8 @@ function encodeUriQuery(val, pctEncodeSpaces) { /** * @ngdoc directive - * @name ng.directive:ngApp + * @name ngApp + * @module ng * * @element ANY * @param {angular.Module} ngApp an optional application @@ -1196,7 +1233,7 @@ function encodeUriQuery(val, pctEncodeSpaces) { * {@link angular.bootstrap} instead. AngularJS applications cannot be nested within each other. * * You can specify an **AngularJS module** to be used as the root module for the application. This - * module will be loaded into the {@link AUTO.$injector} when the application is bootstrapped and + * module will be loaded into the {@link auto.$injector} when the application is bootstrapped and * should contain the application code needed or have dependencies on other modules that will * contain the code. See {@link angular.module} for more information. * @@ -1210,6 +1247,7 @@ function encodeUriQuery(val, pctEncodeSpaces) {
I can add: {{a}} + {{b}} = {{ a+b }} +
angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) { @@ -1267,20 +1305,21 @@ function angularInit(element, bootstrap) { /** * @ngdoc function * @name angular.bootstrap + * @module ng * @description * Use this function to manually start up angular application. * * See: {@link guide/bootstrap Bootstrap} * * Note that ngScenario-based end-to-end tests cannot use this function to bootstrap manually. - * They must use {@link api/ng.directive:ngApp ngApp}. + * They must use {@link ng.directive:ngApp ngApp}. * * @param {Element} element DOM element which is the root of angular application. * @param {Array=} modules an array of modules to load into the application. * Each item in the array should be the name of a predefined module or a (DI annotated) * function that will be invoked by the injector as a run block. * See: {@link angular.module modules} - * @returns {AUTO.$injector} Returns the newly created injector for this app. + * @returns {auto.$injector} Returns the newly created injector for this app. */ function bootstrap(element, modules) { var doBootstrap = function() { @@ -1389,9 +1428,9 @@ function assertNotHasOwnProperty(name, context) { /** * Return the value accessible from the object by path. Any undefined traversals are ignored * @param {Object} obj starting object - * @param {string} path path to traverse - * @param {boolean=true} bindFnToScope - * @returns value as accessible by path + * @param {String} path path to traverse + * @param {boolean} [bindFnToScope=true] + * @returns {Object} value as accessible by path */ //TODO(misko): this function needs to be removed function getter(obj, path, bindFnToScope) { @@ -1416,7 +1455,7 @@ function getter(obj, path, bindFnToScope) { /** * Return the DOM siblings between the first and last node in the given array. * @param {Array} array like object - * @returns jQlite object containing the elements + * @returns {DOMElement} object containing the elements */ function getBlockElements(nodes) { var startNode = nodes[0], @@ -1438,8 +1477,9 @@ function getBlockElements(nodes) { } /** - * @ngdoc interface + * @ngdoc type * @name angular.Module + * @module ng * @description * * Interface for configuring angular {@link angular.module modules}. @@ -1466,6 +1506,7 @@ function setupModuleLoader(window) { /** * @ngdoc function * @name angular.module + * @module ng * @description * * The `angular.module` is a global place for creating, registering and retrieving Angular @@ -1480,9 +1521,9 @@ function setupModuleLoader(window) { * # Module * * A module is a collection of services, directives, filters, and configuration information. - * `angular.module` is used to configure the {@link AUTO.$injector $injector}. + * `angular.module` is used to configure the {@link auto.$injector $injector}. * - *
+     * ```js
      * // Create a new module
      * var myModule = angular.module('myModule', []);
      *
@@ -1494,13 +1535,13 @@ function setupModuleLoader(window) {
      *   // Configure existing providers
      *   $locationProvider.hashPrefix('!');
      * });
-     * 
+ * ``` * * Then you can create an injector and load your modules like this: * - *
+     * ```js
      * var injector = angular.injector(['ng', 'MyModule'])
-     * 
+ * ``` * * However it's more likely that you'll just use * {@link ng.directive:ngApp ngApp} or @@ -1510,7 +1551,7 @@ function setupModuleLoader(window) { * @param {Array.=} requires If specified then new module is being created. If * unspecified then the the module is being retrieved for further configuration. * @param {Function} configFn Optional configuration function for the module. Same as - * {@link angular.Module#methods_config Module#config()}. + * {@link angular.Module#config Module#config()}. * @returns {module} new module with the {@link angular.Module} api. */ return function module(name, requires, configFn) { @@ -1548,6 +1589,7 @@ function setupModuleLoader(window) { /** * @ngdoc property * @name angular.Module#requires + * @module ng * @propertyOf angular.Module * @returns {Array.} List of module names which must be loaded before this module. * @description @@ -1559,6 +1601,7 @@ function setupModuleLoader(window) { /** * @ngdoc property * @name angular.Module#name + * @module ng * @propertyOf angular.Module * @returns {string} Name of the module. * @description @@ -1569,64 +1612,64 @@ function setupModuleLoader(window) { /** * @ngdoc method * @name angular.Module#provider - * @methodOf angular.Module + * @module ng * @param {string} name service name * @param {Function} providerType Construction function for creating new instance of the * service. * @description - * See {@link AUTO.$provide#provider $provide.provider()}. + * See {@link auto.$provide#provider $provide.provider()}. */ provider: invokeLater('$provide', 'provider'), /** * @ngdoc method * @name angular.Module#factory - * @methodOf angular.Module + * @module ng * @param {string} name service name * @param {Function} providerFunction Function for creating new instance of the service. * @description - * See {@link AUTO.$provide#factory $provide.factory()}. + * See {@link auto.$provide#factory $provide.factory()}. */ factory: invokeLater('$provide', 'factory'), /** * @ngdoc method * @name angular.Module#service - * @methodOf angular.Module + * @module ng * @param {string} name service name * @param {Function} constructor A constructor function that will be instantiated. * @description - * See {@link AUTO.$provide#service $provide.service()}. + * See {@link auto.$provide#service $provide.service()}. */ service: invokeLater('$provide', 'service'), /** * @ngdoc method * @name angular.Module#value - * @methodOf angular.Module + * @module ng * @param {string} name service name * @param {*} object Service instance object. * @description - * See {@link AUTO.$provide#value $provide.value()}. + * See {@link auto.$provide#value $provide.value()}. */ value: invokeLater('$provide', 'value'), /** * @ngdoc method * @name angular.Module#constant - * @methodOf angular.Module + * @module ng * @param {string} name constant name * @param {*} object Constant value. * @description * Because the constant are fixed, they get applied before other provide methods. - * See {@link AUTO.$provide#constant $provide.constant()}. + * See {@link auto.$provide#constant $provide.constant()}. */ constant: invokeLater('$provide', 'constant', 'unshift'), /** * @ngdoc method * @name angular.Module#animation - * @methodOf angular.Module + * @module ng * @param {string} name animation name * @param {Function} animationFactory Factory function for creating new instance of an * animation. @@ -1638,7 +1681,7 @@ function setupModuleLoader(window) { * Defines an animation hook that can be later used with * {@link ngAnimate.$animate $animate} service and directives that use this service. * - *
+           * ```js
            * module.animation('.animation-name', function($inject1, $inject2) {
            *   return {
            *     eventName : function(element, done) {
@@ -1650,7 +1693,7 @@ function setupModuleLoader(window) {
            *     }
            *   }
            * })
-           * 
+ * ``` * * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and * {@link ngAnimate ngAnimate module} for more information. @@ -1660,7 +1703,7 @@ function setupModuleLoader(window) { /** * @ngdoc method * @name angular.Module#filter - * @methodOf angular.Module + * @module ng * @param {string} name Filter name. * @param {Function} filterFactory Factory function for creating new instance of filter. * @description @@ -1671,7 +1714,7 @@ function setupModuleLoader(window) { /** * @ngdoc method * @name angular.Module#controller - * @methodOf angular.Module + * @module ng * @param {string|Object} name Controller name, or an object map of controllers where the * keys are the names and the values are the constructors. * @param {Function} constructor Controller constructor function. @@ -1683,20 +1726,20 @@ function setupModuleLoader(window) { /** * @ngdoc method * @name angular.Module#directive - * @methodOf angular.Module + * @module ng * @param {string|Object} name Directive name, or an object map of directives where the * keys are the names and the values are the factories. * @param {Function} directiveFactory Factory function for creating new instance of * directives. * @description - * See {@link ng.$compileProvider#methods_directive $compileProvider.directive()}. + * See {@link ng.$compileProvider#directive $compileProvider.directive()}. */ directive: invokeLater('$compileProvider', 'directive'), /** * @ngdoc method * @name angular.Module#config - * @methodOf angular.Module + * @module ng * @param {Function} configFn Execute this function on module load. Useful for service * configuration. * @description @@ -1707,7 +1750,7 @@ function setupModuleLoader(window) { /** * @ngdoc method * @name angular.Module#run - * @methodOf angular.Module + * @module ng * @param {Function} initializationFn Execute this function after injector creation. * Useful for application initialization. * @description @@ -1747,10 +1790,10 @@ function setupModuleLoader(window) { /* global angularModule: true, version: true, - + $LocaleProvider, $CompileProvider, - + htmlAnchorDirective, inputDirective, inputDirective, @@ -1816,13 +1859,16 @@ function setupModuleLoader(window) { $SnifferProvider, $TemplateCacheProvider, $TimeoutProvider, + $$RAFProvider, + $$AsyncCallbackProvider, $WindowProvider */ /** - * @ngdoc property + * @ngdoc object * @name angular.version + * @module ng * @description * An object that contains information about the current AngularJS version. This object has the * following properties: @@ -1834,11 +1880,11 @@ function setupModuleLoader(window) { * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". */ var version = { - full: '1.2.10', // all of these placeholder strings will be replaced by grunt's + full: '1.2.14', // all of these placeholder strings will be replaced by grunt's major: 1, // package task minor: 2, - dot: 10, - codeName: 'augmented-serendipity' + dot: 14, + codeName: 'feisty-cryokinesis' }; @@ -1954,7 +2000,9 @@ function publishExternalAPI(angular){ $sniffer: $SnifferProvider, $templateCache: $TemplateCacheProvider, $timeout: $TimeoutProvider, - $window: $WindowProvider + $window: $WindowProvider, + $$rAF: $$RAFProvider, + $$asyncCallback : $$AsyncCallbackProvider }); } ]); @@ -1975,6 +2023,7 @@ function publishExternalAPI(angular){ /** * @ngdoc function * @name angular.element + * @module ng * @function * * @description @@ -2000,7 +2049,7 @@ function publishExternalAPI(angular){ * - [`after()`](http://api.jquery.com/after/) * - [`append()`](http://api.jquery.com/append/) * - [`attr()`](http://api.jquery.com/attr/) - * - [`bind()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData + * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData * - [`children()`](http://api.jquery.com/children/) - Does not support selectors * - [`clone()`](http://api.jquery.com/clone/) * - [`contents()`](http://api.jquery.com/contents/) @@ -2027,7 +2076,7 @@ function publishExternalAPI(angular){ * - [`text()`](http://api.jquery.com/text/) * - [`toggleClass()`](http://api.jquery.com/toggleClass/) * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers. - * - [`unbind()`](http://api.jquery.com/off/) - Does not support namespaces + * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces * - [`val()`](http://api.jquery.com/val/) * - [`wrap()`](http://api.jquery.com/wrap/) * @@ -2045,9 +2094,9 @@ function publishExternalAPI(angular){ * camelCase directive name, then the controller for this directive will be retrieved (e.g. * `'ngModel'`). * - `injector()` - retrieves the injector of the current element or its parent. - * - `scope()` - retrieves the {@link api/ng.$rootScope.Scope scope} of the current + * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current * element or its parent. - * - `isolateScope()` - retrieves an isolate {@link api/ng.$rootScope.Scope scope} if one is attached directly to the + * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the * current element. This getter should be used only on elements that contain a directive which starts a new isolate * scope. Calling `scope()` on this element always returns the original non-isolate scope. * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top @@ -2067,6 +2116,14 @@ var jqCache = JQLite.cache = {}, ? function(element, type, fn) {element.removeEventListener(type, fn, false); } : function(element, type, fn) {element.detachEvent('on' + type, fn); }); +/* + * !!! This is an undocumented "private" function !!! + */ +var jqData = JQLite._data = function(node) { + //jQuery always returns an object on cache miss + return this.cache[node[this.expando]] || {}; +}; + function jqNextId() { return ++jqId; } @@ -2135,6 +2192,9 @@ function JQLite(element) { if (element instanceof JQLite) { return element; } + if (isString(element)) { + element = trim(element); + } if (!(this instanceof JQLite)) { if (isString(element) && element.charAt(0) != '<') { throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element'); @@ -2741,7 +2801,7 @@ forEach({ }, contents: function(element) { - return element.childNodes || []; + return element.contentDocument || element.childNodes || []; }, append: function(element, node) { @@ -2788,10 +2848,15 @@ forEach({ removeClass: jqLiteRemoveClass, toggleClass: function(element, selector, condition) { - if (isUndefined(condition)) { - condition = !jqLiteHasClass(element, selector); + if (selector) { + forEach(selector.split(' '), function(className){ + var classCondition = condition; + if (isUndefined(classCondition)) { + classCondition = !jqLiteHasClass(element, className); + } + (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className); + }); } - (condition ? jqLiteAddClass : jqLiteRemoveClass)(element, selector); }, parent: function(element) { @@ -2909,7 +2974,7 @@ HashMap.prototype = { /** * @param key - * @returns the value for the key + * @returns {Object} the value for the key */ get: function(key) { return this[hashKey(key)]; @@ -2928,6 +2993,7 @@ HashMap.prototype = { /** * @ngdoc function + * @module ng * @name angular.injector * @function * @@ -2938,11 +3004,11 @@ HashMap.prototype = { * @param {Array.} modules A list of module functions or their aliases. See * {@link angular.module}. The `ng` module must be explicitly added. - * @returns {function()} Injector function. See {@link AUTO.$injector $injector}. + * @returns {function()} Injector function. See {@link auto.$injector $injector}. * * @example * Typical usage - *
+ * ```js
  *   // create an injector
  *   var $injector = angular.injector(['ng']);
  *
@@ -2952,7 +3018,7 @@ HashMap.prototype = {
  *     $compile($document)($rootScope);
  *     $rootScope.$digest();
  *   });
- * 
+ * ``` * * Sometimes you want to get access to the injector of a currently running Angular app * from outside Angular. Perhaps, you want to inject and compile some markup after the @@ -2966,7 +3032,7 @@ HashMap.prototype = { * directive is added to the end of the document body by JQuery. We then compile and link * it into the current AngularJS scope. * - *
+ * ```js
  * var $div = $('
{{content.label}}
'); * $(document.body).append($div); * @@ -2974,16 +3040,16 @@ HashMap.prototype = { * var scope = angular.element($div).scope(); * $compile($div)(scope); * }); - *
+ * ``` */ /** - * @ngdoc overview - * @name AUTO + * @ngdoc module + * @name auto * @description * - * Implicit module which gets automatically added to each {@link AUTO.$injector $injector}. + * Implicit module which gets automatically added to each {@link auto.$injector $injector}. */ var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; @@ -3024,32 +3090,32 @@ function annotate(fn) { /////////////////////////////////////// /** - * @ngdoc object - * @name AUTO.$injector + * @ngdoc service + * @name $injector * @function * * @description * * `$injector` is used to retrieve object instances as defined by - * {@link AUTO.$provide provider}, instantiate types, invoke methods, + * {@link auto.$provide provider}, instantiate types, invoke methods, * and load modules. * * The following always holds true: * - *
+ * ```js
  *   var $injector = angular.injector();
  *   expect($injector.get('$injector')).toBe($injector);
  *   expect($injector.invoke(function($injector){
  *     return $injector;
  *   }).toBe($injector);
- * 
+ * ``` * * # Injection Function Annotation * * JavaScript does not have annotations, and annotations are needed for dependency injection. The * following are all valid ways of annotating function with injection arguments and are equivalent. * - *
+ * ```js
  *   // inferred (only works if code not minified/obfuscated)
  *   $injector.invoke(function(serviceA){});
  *
@@ -3060,7 +3126,7 @@ function annotate(fn) {
  *
  *   // inline
  *   $injector.invoke(['serviceA', function(serviceA){}]);
- * 
+ * ``` * * ## Inference * @@ -3077,8 +3143,7 @@ function annotate(fn) { /** * @ngdoc method - * @name AUTO.$injector#get - * @methodOf AUTO.$injector + * @name $injector#get * * @description * Return an instance of the service. @@ -3089,13 +3154,12 @@ function annotate(fn) { /** * @ngdoc method - * @name AUTO.$injector#invoke - * @methodOf AUTO.$injector + * @name $injector#invoke * * @description * Invoke the method and supply the method arguments from the `$injector`. * - * @param {!function} fn The function to invoke. Function parameters are injected according to the + * @param {!Function} fn The function to invoke. Function parameters are injected according to the * {@link guide/di $inject Annotation} rules. * @param {Object=} self The `this` for the invoked method. * @param {Object=} locals Optional object. If preset then any argument names are read from this @@ -3105,8 +3169,7 @@ function annotate(fn) { /** * @ngdoc method - * @name AUTO.$injector#has - * @methodOf AUTO.$injector + * @name $injector#has * * @description * Allows the user to query if the particular service exist. @@ -3117,14 +3180,13 @@ function annotate(fn) { /** * @ngdoc method - * @name AUTO.$injector#instantiate - * @methodOf AUTO.$injector + * @name $injector#instantiate * @description * Create a new instance of JS type. The method takes a constructor function invokes the new * operator and supplies all of the arguments to the constructor function as specified by the * constructor annotation. * - * @param {function} Type Annotated constructor function. + * @param {Function} Type Annotated constructor function. * @param {Object=} locals Optional object. If preset then any argument names are read from this * object first, before the `$injector` is consulted. * @returns {Object} new instance of `Type`. @@ -3132,8 +3194,7 @@ function annotate(fn) { /** * @ngdoc method - * @name AUTO.$injector#annotate - * @methodOf AUTO.$injector + * @name $injector#annotate * * @description * Returns an array of service names which the function is requesting for injection. This API is @@ -3146,7 +3207,7 @@ function annotate(fn) { * The simplest form is to extract the dependencies from the arguments of the function. This is done * by converting the function into a string using `toString()` method and extracting the argument * names. - *
+ * ```js
  *   // Given
  *   function MyController($scope, $route) {
  *     // ...
@@ -3154,7 +3215,7 @@ function annotate(fn) {
  *
  *   // Then
  *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
- * 
+ * ``` * * This method does not work with code minification / obfuscation. For this reason the following * annotation strategies are supported. @@ -3163,7 +3224,7 @@ function annotate(fn) { * * If a function has an `$inject` property and its value is an array of strings, then the strings * represent names of services to be injected into the function. - *
+ * ```js
  *   // Given
  *   var MyController = function(obfuscatedScope, obfuscatedRoute) {
  *     // ...
@@ -3173,7 +3234,7 @@ function annotate(fn) {
  *
  *   // Then
  *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
- * 
+ * ``` * * # The array notation * @@ -3181,7 +3242,7 @@ function annotate(fn) { * is very inconvenient. In these situations using the array notation to specify the dependencies in * a way that survives minification is a better choice: * - *
+ * ```js
  *   // We wish to write this (not minification / obfuscation safe)
  *   injector.invoke(function($compile, $rootScope) {
  *     // ...
@@ -3203,9 +3264,9 @@ function annotate(fn) {
  *   expect(injector.annotate(
  *      ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
  *    ).toEqual(['$compile', '$rootScope']);
- * 
+ * ``` * - * @param {function|Array.} fn Function for which dependent service names need to + * @param {Function|Array.} fn Function for which dependent service names need to * be retrieved as described above. * * @returns {Array.} The names of the services which the function requires. @@ -3216,12 +3277,12 @@ function annotate(fn) { /** * @ngdoc object - * @name AUTO.$provide + * @name $provide * * @description * - * The {@link AUTO.$provide $provide} service has a number of methods for registering components - * with the {@link AUTO.$injector $injector}. Many of these functions are also exposed on + * The {@link auto.$provide $provide} service has a number of methods for registering components + * with the {@link auto.$injector $injector}. Many of these functions are also exposed on * {@link angular.Module}. * * An Angular **service** is a singleton object created by a **service factory**. These **service @@ -3229,25 +3290,25 @@ function annotate(fn) { * The **service providers** are constructor functions. When instantiated they must contain a * property called `$get`, which holds the **service factory** function. * - * When you request a service, the {@link AUTO.$injector $injector} is responsible for finding the + * When you request a service, the {@link auto.$injector $injector} is responsible for finding the * correct **service provider**, instantiating it and then calling its `$get` **service factory** * function to get the instance of the **service**. * * Often services have no configuration options and there is no need to add methods to the service * provider. The provider will be no more than a constructor function with a `$get` property. For - * these cases the {@link AUTO.$provide $provide} service has additional helper methods to register + * these cases the {@link auto.$provide $provide} service has additional helper methods to register * services without specifying a provider. * - * * {@link AUTO.$provide#methods_provider provider(provider)} - registers a **service provider** with the - * {@link AUTO.$injector $injector} - * * {@link AUTO.$provide#methods_constant constant(obj)} - registers a value/object that can be accessed by + * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the + * {@link auto.$injector $injector} + * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by * providers and services. - * * {@link AUTO.$provide#methods_value value(obj)} - registers a value/object that can only be accessed by + * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by * services, not providers. - * * {@link AUTO.$provide#methods_factory factory(fn)} - registers a service **factory function**, `fn`, + * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`, * that will be wrapped in a **service provider** object, whose `$get` property will contain the * given factory function. - * * {@link AUTO.$provide#methods_service service(class)} - registers a **constructor function**, `class` that + * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class` * that will be wrapped in a **service provider** object, whose `$get` property will instantiate * a new object using the given constructor function. * @@ -3256,11 +3317,10 @@ function annotate(fn) { /** * @ngdoc method - * @name AUTO.$provide#provider - * @methodOf AUTO.$provide + * @name $provide#provider * @description * - * Register a **provider function** with the {@link AUTO.$injector $injector}. Provider functions + * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions * are constructor functions, whose instances are responsible for "providing" a factory for a * service. * @@ -3280,18 +3340,18 @@ function annotate(fn) { * @param {(Object|function())} provider If the provider is: * * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using - * {@link AUTO.$injector#invoke $injector.invoke()} when an instance needs to be created. - * - `Constructor`: a new instance of the provider will be created using - * {@link AUTO.$injector#instantiate $injector.instantiate()}, then treated as `object`. + * {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created. + * - `Constructor`: a new instance of the provider will be created using + * {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`. * * @returns {Object} registered provider instance * @example * * The following example shows how to create a simple event tracking service and register it using - * {@link AUTO.$provide#methods_provider $provide.provider()}. + * {@link auto.$provide#provider $provide.provider()}. * - *
+ * ```js
  *  // Define the eventTracker provider
  *  function EventTrackerProvider() {
  *    var trackingUrl = '/track';
@@ -3348,19 +3408,18 @@ function annotate(fn) {
  *      expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
  *    }));
  *  });
- * 
+ * ``` */ /** * @ngdoc method - * @name AUTO.$provide#factory - * @methodOf AUTO.$provide + * @name $provide#factory * @description * * Register a **service factory**, which will be called to return the service instance. * This is short for registering a service where its provider consists of only a `$get` property, * which is the given service factory function. - * You should use {@link AUTO.$provide#factory $provide.factory(getFn)} if you do not need to + * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to * configure your service in a provider. * * @param {string} name The name of the instance. @@ -3370,26 +3429,25 @@ function annotate(fn) { * * @example * Here is an example of registering a service - *
+ * ```js
  *   $provide.factory('ping', ['$http', function($http) {
  *     return function ping() {
  *       return $http.send('/ping');
  *     };
  *   }]);
- * 
+ * ``` * You would then inject and use this service like this: - *
+ * ```js
  *   someModule.controller('Ctrl', ['ping', function(ping) {
  *     ping();
  *   }]);
- * 
+ * ``` */ /** * @ngdoc method - * @name AUTO.$provide#service - * @methodOf AUTO.$provide + * @name $provide#service * @description * * Register a **service constructor**, which will be invoked with `new` to create the service @@ -3397,7 +3455,7 @@ function annotate(fn) { * This is short for registering a service where its provider's `$get` property is the service * constructor function that will be used to instantiate the service instance. * - * You should use {@link AUTO.$provide#methods_service $provide.service(class)} if you define your service + * You should use {@link auto.$provide#service $provide.service(class)} if you define your service * as a type/class. * * @param {string} name The name of the instance. @@ -3406,36 +3464,34 @@ function annotate(fn) { * * @example * Here is an example of registering a service using - * {@link AUTO.$provide#methods_service $provide.service(class)}. - *
- *   $provide.service('ping', ['$http', function($http) {
- *     var Ping = function() {
- *       this.$http = $http;
- *     };
- *   
- *     Ping.prototype.send = function() {
- *       return this.$http.get('/ping');
- *     }; 
- *   
- *     return Ping;
- *   }]);
- * 
+ * {@link auto.$provide#service $provide.service(class)}. + * ```js + * var Ping = function($http) { + * this.$http = $http; + * }; + * + * Ping.$inject = ['$http']; + * + * Ping.prototype.send = function() { + * return this.$http.get('/ping'); + * }; + * $provide.service('ping', Ping); + * ``` * You would then inject and use this service like this: - *
+ * ```js
  *   someModule.controller('Ctrl', ['ping', function(ping) {
  *     ping.send();
  *   }]);
- * 
+ * ``` */ /** * @ngdoc method - * @name AUTO.$provide#value - * @methodOf AUTO.$provide + * @name $provide#value * @description * - * Register a **value service** with the {@link AUTO.$injector $injector}, such as a string, a + * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a * number, an array, an object or a function. This is short for registering a service where its * provider's `$get` property is a factory function that takes no arguments and returns the **value * service**. @@ -3443,7 +3499,7 @@ function annotate(fn) { * Value services are similar to constant services, except that they cannot be injected into a * module configuration function (see {@link angular.Module#config}) but they can be overridden by * an Angular - * {@link AUTO.$provide#decorator decorator}. + * {@link auto.$provide#decorator decorator}. * * @param {string} name The name of the instance. * @param {*} value The value. @@ -3451,7 +3507,7 @@ function annotate(fn) { * * @example * Here are some examples of creating value services. - *
+ * ```js
  *   $provide.value('ADMIN_USER', 'admin');
  *
  *   $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
@@ -3459,20 +3515,19 @@ function annotate(fn) {
  *   $provide.value('halfOf', function(value) {
  *     return value / 2;
  *   });
- * 
+ * ``` */ /** * @ngdoc method - * @name AUTO.$provide#constant - * @methodOf AUTO.$provide + * @name $provide#constant * @description * * Register a **constant service**, such as a string, a number, an array, an object or a function, - * with the {@link AUTO.$injector $injector}. Unlike {@link AUTO.$provide#value value} it can be + * with the {@link auto.$injector $injector}. Unlike {@link auto.$provide#value value} it can be * injected into a module configuration function (see {@link angular.Module#config}) and it cannot - * be overridden by an Angular {@link AUTO.$provide#decorator decorator}. + * be overridden by an Angular {@link auto.$provide#decorator decorator}. * * @param {string} name The name of the constant. * @param {*} value The constant value. @@ -3480,7 +3535,7 @@ function annotate(fn) { * * @example * Here a some examples of creating constants: - *
+ * ```js
  *   $provide.constant('SHARD_HEIGHT', 306);
  *
  *   $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
@@ -3488,17 +3543,16 @@ function annotate(fn) {
  *   $provide.constant('double', function(value) {
  *     return value * 2;
  *   });
- * 
+ * ``` */ /** * @ngdoc method - * @name AUTO.$provide#decorator - * @methodOf AUTO.$provide + * @name $provide#decorator * @description * - * Register a **service decorator** with the {@link AUTO.$injector $injector}. A service decorator + * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator * intercepts the creation of a service, allowing it to override or modify the behaviour of the * service. The object returned by the decorator may be the original service, or a new service * object which replaces or wraps and delegates to the original service. @@ -3506,7 +3560,7 @@ function annotate(fn) { * @param {string} name The name of the service to decorate. * @param {function()} decorator This function will be invoked when the service needs to be * instantiated and should return the decorated service instance. The function is called using - * the {@link AUTO.$injector#invoke injector.invoke} method and is therefore fully injectable. + * the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable. * Local injection arguments: * * * `$delegate` - The original service instance, which can be monkey patched, configured, @@ -3515,12 +3569,12 @@ function annotate(fn) { * @example * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting * calls to {@link ng.$log#error $log.warn()}. - *
- *   $provider.decorator('$log', ['$delegate', function($delegate) {
+ * ```js
+ *   $provide.decorator('$log', ['$delegate', function($delegate) {
  *     $delegate.warn = $delegate.error;
  *     return $delegate;
  *   }]);
- * 
+ * ``` */ @@ -3734,8 +3788,9 @@ function createInjector(modulesToLoad) { } /** - * @ngdoc function - * @name ng.$anchorScroll + * @ngdoc service + * @name $anchorScroll + * @kind function * @requires $window * @requires $location * @requires $rootScope @@ -3743,11 +3798,11 @@ function createInjector(modulesToLoad) { * @description * When called, it checks current value of `$location.hash()` and scroll to related element, * according to rules specified in - * {@link http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document Html5 spec}. + * [Html5 spec](http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document). * * It also watches the `$location.hash()` and scrolls whenever it changes to match any anchor. * This can be disabled by calling `$anchorScrollProvider.disableAutoScrolling()`. - * + * * @example @@ -3762,10 +3817,10 @@ function createInjector(modulesToLoad) { // set the location.hash to the id of // the element you wish to scroll to. $location.hash('bottom'); - + // call $anchorScroll() $anchorScroll(); - } + }; } @@ -3836,8 +3891,8 @@ function $AnchorScrollProvider() { var $animateMinErr = minErr('$animate'); /** - * @ngdoc object - * @name ng.$animateProvider + * @ngdoc provider + * @name $animateProvider * * @description * Default implementation of $animate that doesn't perform any animations, instead just @@ -3850,14 +3905,13 @@ var $animateMinErr = minErr('$animate'); */ var $AnimateProvider = ['$provide', function($provide) { - + this.$$selectors = {}; /** - * @ngdoc function - * @name ng.$animateProvider#register - * @methodOf ng.$animateProvider + * @ngdoc method + * @name $animateProvider#register * * @description * Registers a new injectable animation factory function. The factory function produces the @@ -3870,7 +3924,7 @@ var $AnimateProvider = ['$provide', function($provide) { * triggered. * * - *
+   * ```js
    *   return {
      *     eventFn : function(element, done) {
      *       //code to run the animation
@@ -3880,10 +3934,10 @@ var $AnimateProvider = ['$provide', function($provide) {
      *       }
      *     }
      *   }
-   *
+ * ``` * * @param {string} name The name of the animation. - * @param {function} factory The factory function that will be executed to return the animation + * @param {Function} factory The factory function that will be executed to return the animation * object. */ this.register = function(name, factory) { @@ -3895,9 +3949,8 @@ var $AnimateProvider = ['$provide', function($provide) { }; /** - * @ngdoc function - * @name ng.$animateProvider#classNameFilter - * @methodOf ng.$animateProvider + * @ngdoc method + * @name $animateProvider#classNameFilter * * @description * Sets and/or returns the CSS class regular expression that is checked when performing @@ -3916,12 +3969,16 @@ var $AnimateProvider = ['$provide', function($provide) { return this.$$classNameFilter; }; - this.$get = ['$timeout', function($timeout) { + this.$get = ['$timeout', '$$asyncCallback', function($timeout, $$asyncCallback) { + + function async(fn) { + fn && $$asyncCallback(fn); + } /** * - * @ngdoc object - * @name ng.$animate + * @ngdoc service + * @name $animate * @description The $animate service provides rudimentary DOM manipulation functions to * insert, remove and move elements within the DOM, as well as adding and removing classes. * This service is the core service used by the ngAnimate $animator service which provides @@ -3939,18 +3996,17 @@ var $AnimateProvider = ['$provide', function($provide) { /** * - * @ngdoc function - * @name ng.$animate#enter - * @methodOf ng.$animate + * @ngdoc method + * @name $animate#enter * @function * @description Inserts the element into the DOM either after the `after` element or within * the `parent` element. Once complete, the done() callback will be fired (if provided). - * @param {jQuery/jqLite element} element the element which will be inserted into the DOM - * @param {jQuery/jqLite element} parent the parent element which will append the element as + * @param {DOMElement} element the element which will be inserted into the DOM + * @param {DOMElement} parent the parent element which will append the element as * a child (if the after element is not present) - * @param {jQuery/jqLite element} after the sibling element which will append the element + * @param {DOMElement} after the sibling element which will append the element * after itself - * @param {function=} done callback function that will be called after the element has been + * @param {Function=} done callback function that will be called after the element has been * inserted into the DOM */ enter : function(element, parent, after, done) { @@ -3962,43 +4018,41 @@ var $AnimateProvider = ['$provide', function($provide) { } parent.append(element); } - done && $timeout(done, 0, false); + async(done); }, /** * - * @ngdoc function - * @name ng.$animate#leave - * @methodOf ng.$animate + * @ngdoc method + * @name $animate#leave * @function * @description Removes the element from the DOM. Once complete, the done() callback will be * fired (if provided). - * @param {jQuery/jqLite element} element the element which will be removed from the DOM - * @param {function=} done callback function that will be called after the element has been + * @param {DOMElement} element the element which will be removed from the DOM + * @param {Function=} done callback function that will be called after the element has been * removed from the DOM */ leave : function(element, done) { element.remove(); - done && $timeout(done, 0, false); + async(done); }, /** * - * @ngdoc function - * @name ng.$animate#move - * @methodOf ng.$animate + * @ngdoc method + * @name $animate#move * @function * @description Moves the position of the provided element within the DOM to be placed * either after the `after` element or inside of the `parent` element. Once complete, the * done() callback will be fired (if provided). - * - * @param {jQuery/jqLite element} element the element which will be moved around within the + * + * @param {DOMElement} element the element which will be moved around within the * DOM - * @param {jQuery/jqLite element} parent the parent element where the element will be + * @param {DOMElement} parent the parent element where the element will be * inserted into (if the after element is not present) - * @param {jQuery/jqLite element} after the sibling element where the element will be + * @param {DOMElement} after the sibling element where the element will be * positioned next to - * @param {function=} done the callback function (if provided) that will be fired after the + * @param {Function=} done the callback function (if provided) that will be fired after the * element has been moved to its new position */ move : function(element, parent, after, done) { @@ -4009,16 +4063,15 @@ var $AnimateProvider = ['$provide', function($provide) { /** * - * @ngdoc function - * @name ng.$animate#addClass - * @methodOf ng.$animate + * @ngdoc method + * @name $animate#addClass * @function * @description Adds the provided className CSS class value to the provided element. Once * complete, the done() callback will be fired (if provided). - * @param {jQuery/jqLite element} element the element which will have the className value + * @param {DOMElement} element the element which will have the className value * added to it * @param {string} className the CSS class which will be added to the element - * @param {function=} done the callback function (if provided) that will be fired after the + * @param {Function=} done the callback function (if provided) that will be fired after the * className value has been added to the element */ addClass : function(element, className, done) { @@ -4028,21 +4081,20 @@ var $AnimateProvider = ['$provide', function($provide) { forEach(element, function (element) { jqLiteAddClass(element, className); }); - done && $timeout(done, 0, false); + async(done); }, /** * - * @ngdoc function - * @name ng.$animate#removeClass - * @methodOf ng.$animate + * @ngdoc method + * @name $animate#removeClass * @function * @description Removes the provided className CSS class value from the provided element. * Once complete, the done() callback will be fired (if provided). - * @param {jQuery/jqLite element} element the element which will have the className value + * @param {DOMElement} element the element which will have the className value * removed from it * @param {string} className the CSS class which will be removed from the element - * @param {function=} done the callback function (if provided) that will be fired after the + * @param {Function=} done the callback function (if provided) that will be fired after the * className value has been removed from the element */ removeClass : function(element, className, done) { @@ -4052,7 +4104,29 @@ var $AnimateProvider = ['$provide', function($provide) { forEach(element, function (element) { jqLiteRemoveClass(element, className); }); - done && $timeout(done, 0, false); + async(done); + }, + + /** + * + * @ngdoc method + * @name $animate#setClass + * @function + * @description Adds and/or removes the given CSS classes to and from the element. + * Once complete, the done() callback will be fired (if provided). + * @param {DOMElement} element the element which will it's CSS classes changed + * removed from it + * @param {string} add the CSS classes which will be added to the element + * @param {string} remove the CSS class which will be removed from the element + * @param {Function=} done the callback function (if provided) that will be fired after the + * CSS classes have been set on the element + */ + setClass : function(element, add, remove, done) { + forEach(element, function (element) { + jqLiteAddClass(element, add); + jqLiteRemoveClass(element, remove); + }); + async(done); }, enabled : noop @@ -4060,10 +4134,20 @@ var $AnimateProvider = ['$provide', function($provide) { }]; }]; +function $$AsyncCallbackProvider(){ + this.$get = ['$$rAF', '$timeout', function($$rAF, $timeout) { + return $$rAF.supported + ? function(fn) { return $$rAF(fn); } + : function(fn) { + return $timeout(fn, 0, false); + }; + }]; +} + /** * ! This is a private undocumented service ! * - * @name ng.$browser + * @name $browser * @requires $log * @description * This object has two goals: @@ -4147,8 +4231,7 @@ function Browser(window, document, $log, $sniffer) { pollTimeout; /** - * @name ng.$browser#addPollFn - * @methodOf ng.$browser + * @name $browser#addPollFn * * @param {function()} fn Poll function to add * @@ -4188,8 +4271,7 @@ function Browser(window, document, $log, $sniffer) { newLocation = null; /** - * @name ng.$browser#url - * @methodOf ng.$browser + * @name $browser#url * * @description * GETTER: @@ -4255,8 +4337,7 @@ function Browser(window, document, $log, $sniffer) { } /** - * @name ng.$browser#onUrlChange - * @methodOf ng.$browser + * @name $browser#onUrlChange * @TODO(vojta): refactor to use node's syntax for events * * @description @@ -4302,14 +4383,13 @@ function Browser(window, document, $log, $sniffer) { ////////////////////////////////////////////////////////////// /** - * @name ng.$browser#baseHref - * @methodOf ng.$browser + * @name $browser#baseHref * * @description * Returns current * (always relative - without domain) * - * @returns {string=} current + * @returns {string} The current base href */ self.baseHref = function() { var href = baseElement.attr('href'); @@ -4324,8 +4404,7 @@ function Browser(window, document, $log, $sniffer) { var cookiePath = self.baseHref(); /** - * @name ng.$browser#cookies - * @methodOf ng.$browser + * @name $browser#cookies * * @param {string=} name Cookie name * @param {string=} value Cookie value @@ -4394,8 +4473,7 @@ function Browser(window, document, $log, $sniffer) { /** - * @name ng.$browser#defer - * @methodOf ng.$browser + * @name $browser#defer * @param {function()} fn A function, who's execution should be deferred. * @param {number=} [delay=0] of milliseconds to defer the function execution. * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`. @@ -4421,8 +4499,7 @@ function Browser(window, document, $log, $sniffer) { /** - * @name ng.$browser#defer.cancel - * @methodOf ng.$browser.defer + * @name $browser#defer.cancel * * @description * Cancels a deferred task identified with `deferId`. @@ -4451,14 +4528,14 @@ function $BrowserProvider(){ } /** - * @ngdoc object - * @name ng.$cacheFactory + * @ngdoc service + * @name $cacheFactory * * @description * Factory that constructs cache objects and gives access to them. - * - *
- * 
+ *
+ * ```js
+ *
  *  var cache = $cacheFactory('cacheId');
  *  expect($cacheFactory.get('cacheId')).toBe(cache);
  *  expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
@@ -4467,9 +4544,9 @@ function $BrowserProvider(){
  *  cache.put("another key", "another value");
  *
  *  // We've specified no options on creation
- *  expect(cache.info()).toEqual({id: 'cacheId', size: 2}); 
- * 
- * 
+ * expect(cache.info()).toEqual({id: 'cacheId', size: 2}); + * + * ``` * * * @param {string} cacheId Name or id of the newly created cache. @@ -4509,9 +4586,11 @@ function $CacheFactoryProvider() { return caches[cacheId] = { put: function(key, value) { - var lruEntry = lruHash[key] || (lruHash[key] = {key: key}); + if (capacity < Number.MAX_VALUE) { + var lruEntry = lruHash[key] || (lruHash[key] = {key: key}); - refresh(lruEntry); + refresh(lruEntry); + } if (isUndefined(value)) return; if (!(key in data)) size++; @@ -4526,26 +4605,31 @@ function $CacheFactoryProvider() { get: function(key) { - var lruEntry = lruHash[key]; + if (capacity < Number.MAX_VALUE) { + var lruEntry = lruHash[key]; - if (!lruEntry) return; + if (!lruEntry) return; - refresh(lruEntry); + refresh(lruEntry); + } return data[key]; }, remove: function(key) { - var lruEntry = lruHash[key]; + if (capacity < Number.MAX_VALUE) { + var lruEntry = lruHash[key]; - if (!lruEntry) return; + if (!lruEntry) return; - if (lruEntry == freshEnd) freshEnd = lruEntry.p; - if (lruEntry == staleEnd) staleEnd = lruEntry.n; - link(lruEntry.n,lruEntry.p); + if (lruEntry == freshEnd) freshEnd = lruEntry.p; + if (lruEntry == staleEnd) staleEnd = lruEntry.n; + link(lruEntry.n,lruEntry.p); + + delete lruHash[key]; + } - delete lruHash[key]; delete data[key]; size--; }, @@ -4606,8 +4690,7 @@ function $CacheFactoryProvider() { /** * @ngdoc method - * @name ng.$cacheFactory#info - * @methodOf ng.$cacheFactory + * @name $cacheFactory#info * * @description * Get information about all the of the caches that have been created @@ -4625,8 +4708,7 @@ function $CacheFactoryProvider() { /** * @ngdoc method - * @name ng.$cacheFactory#get - * @methodOf ng.$cacheFactory + * @name $cacheFactory#get * * @description * Get access to a cache object by the `cacheId` used when it was created. @@ -4644,16 +4726,16 @@ function $CacheFactoryProvider() { } /** - * @ngdoc object - * @name ng.$templateCache + * @ngdoc service + * @name $templateCache * * @description * The first time a template is used, it is loaded in the template cache for quick retrieval. You * can load templates directly into the cache in a `script` tag, or by consuming the * `$templateCache` service directly. - * + * * Adding via the `script` tag: - *
+ * ```html
  * 
  * 
  * 
-
-          
-
- Date format:
- Current time is: -
- Blood 1 : {{blood_1}} - Blood 2 : {{blood_2}} - - - -
-
- - - + * + * + * + * + *
+ *
+ * Date format:
+ * Current time is: + *
+ * Blood 1 : {{blood_1}} + * Blood 2 : {{blood_2}} + * + * + * + *
+ *
+ * + *
+ *
*/ function interval(fn, delay, count, invokeApply) { var setInterval = $window.setInterval, @@ -8441,9 +8572,8 @@ function $IntervalProvider() { /** - * @ngdoc function - * @name ng.$interval#cancel - * @methodOf ng.$interval + * @ngdoc method + * @name $interval#cancel * * @description * Cancels a task associated with the `promise`. @@ -8466,8 +8596,8 @@ function $IntervalProvider() { } /** - * @ngdoc object - * @name ng.$locale + * @ngdoc service + * @name $locale * * @description * $locale service provides localization rules for various Angular components. As of right now the @@ -8826,14 +8956,13 @@ LocationHashbangInHtml5Url.prototype = /** * @ngdoc method - * @name ng.$location#absUrl - * @methodOf ng.$location + * @name $location#absUrl * * @description * This method is getter only. * * Return full url representation with all segments encoded according to rules specified in - * {@link http://www.ietf.org/rfc/rfc3986.txt RFC 3986}. + * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt). * * @return {string} full url */ @@ -8841,8 +8970,7 @@ LocationHashbangInHtml5Url.prototype = /** * @ngdoc method - * @name ng.$location#url - * @methodOf ng.$location + * @name $location#url * * @description * This method is getter / setter. @@ -8869,8 +8997,7 @@ LocationHashbangInHtml5Url.prototype = /** * @ngdoc method - * @name ng.$location#protocol - * @methodOf ng.$location + * @name $location#protocol * * @description * This method is getter only. @@ -8883,8 +9010,7 @@ LocationHashbangInHtml5Url.prototype = /** * @ngdoc method - * @name ng.$location#host - * @methodOf ng.$location + * @name $location#host * * @description * This method is getter only. @@ -8897,8 +9023,7 @@ LocationHashbangInHtml5Url.prototype = /** * @ngdoc method - * @name ng.$location#port - * @methodOf ng.$location + * @name $location#port * * @description * This method is getter only. @@ -8911,8 +9036,7 @@ LocationHashbangInHtml5Url.prototype = /** * @ngdoc method - * @name ng.$location#path - * @methodOf ng.$location + * @name $location#path * * @description * This method is getter / setter. @@ -8933,8 +9057,7 @@ LocationHashbangInHtml5Url.prototype = /** * @ngdoc method - * @name ng.$location#search - * @methodOf ng.$location + * @name $location#search * * @description * This method is getter / setter. @@ -8981,8 +9104,7 @@ LocationHashbangInHtml5Url.prototype = /** * @ngdoc method - * @name ng.$location#hash - * @methodOf ng.$location + * @name $location#hash * * @description * This method is getter / setter. @@ -8998,8 +9120,7 @@ LocationHashbangInHtml5Url.prototype = /** * @ngdoc method - * @name ng.$location#replace - * @methodOf ng.$location + * @name $location#replace * * @description * If called, all changes to $location during current `$digest` will be replacing current history @@ -9032,16 +9153,14 @@ function locationGetterSetter(property, preprocess) { /** - * @ngdoc object - * @name ng.$location + * @ngdoc service + * @name $location * - * @requires $browser - * @requires $sniffer * @requires $rootElement * * @description * The $location service parses the URL in the browser address bar (based on the - * {@link https://developer.mozilla.org/en/window.location window.location}) and makes the URL + * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL * available to your application. Changes to the URL in the address bar are reflected into * $location service and changes to $location are reflected into the browser address bar. * @@ -9061,8 +9180,8 @@ function locationGetterSetter(property, preprocess) { */ /** - * @ngdoc object - * @name ng.$locationProvider + * @ngdoc provider + * @name $locationProvider * @description * Use the `$locationProvider` to configure how the application deep linking paths are stored. */ @@ -9072,8 +9191,7 @@ function $LocationProvider(){ /** * @ngdoc property - * @name ng.$locationProvider#hashPrefix - * @methodOf ng.$locationProvider + * @name $locationProvider#hashPrefix * @description * @param {string=} prefix Prefix for hash part (containing path and search) * @returns {*} current value if used as getter or itself (chaining) if used as setter @@ -9089,8 +9207,7 @@ function $LocationProvider(){ /** * @ngdoc property - * @name ng.$locationProvider#html5Mode - * @methodOf ng.$locationProvider + * @name $locationProvider#html5Mode * @description * @param {boolean=} mode Use HTML5 strategy if available. * @returns {*} current value if used as getter or itself (chaining) if used as setter @@ -9106,8 +9223,7 @@ function $LocationProvider(){ /** * @ngdoc event - * @name ng.$location#$locationChangeStart - * @eventOf ng.$location + * @name $location#$locationChangeStart * @eventType broadcast on root scope * @description * Broadcasted before a URL will change. This change can be prevented by calling @@ -9122,8 +9238,7 @@ function $LocationProvider(){ /** * @ngdoc event - * @name ng.$location#$locationChangeSuccess - * @eventOf ng.$location + * @name $location#$locationChangeSuccess * @eventType broadcast on root scope * @description * Broadcasted after a URL was changed. @@ -9244,14 +9359,14 @@ function $LocationProvider(){ } /** - * @ngdoc object - * @name ng.$log + * @ngdoc service + * @name $log * @requires $window * * @description * Simple service for logging. Default implementation safely writes the message * into the browser's console (if present). - * + * * The main purpose of this service is to simplify debugging and troubleshooting. * * The default is to log `debug` messages. You can use @@ -9280,21 +9395,20 @@ function $LocationProvider(){ */ /** - * @ngdoc object - * @name ng.$logProvider + * @ngdoc provider + * @name $logProvider * @description * Use the `$logProvider` to configure how the application logs messages */ function $LogProvider(){ var debug = true, self = this; - + /** * @ngdoc property - * @name ng.$logProvider#debugEnabled - * @methodOf ng.$logProvider + * @name $logProvider#debugEnabled * @description - * @param {string=} flag enable or disable debug level messages + * @param {boolean=} flag enable or disable debug level messages * @returns {*} current value if used as getter or itself (chaining) if used as setter */ this.debugEnabled = function(flag) { @@ -9305,13 +9419,12 @@ function $LogProvider(){ return debug; } }; - + this.$get = ['$window', function($window){ return { /** * @ngdoc method - * @name ng.$log#log - * @methodOf ng.$log + * @name $log#log * * @description * Write a log message @@ -9320,8 +9433,7 @@ function $LogProvider(){ /** * @ngdoc method - * @name ng.$log#info - * @methodOf ng.$log + * @name $log#info * * @description * Write an information message @@ -9330,8 +9442,7 @@ function $LogProvider(){ /** * @ngdoc method - * @name ng.$log#warn - * @methodOf ng.$log + * @name $log#warn * * @description * Write a warning message @@ -9340,19 +9451,17 @@ function $LogProvider(){ /** * @ngdoc method - * @name ng.$log#error - * @methodOf ng.$log + * @name $log#error * * @description * Write an error message */ error: consoleLog('error'), - + /** * @ngdoc method - * @name ng.$log#debug - * @methodOf ng.$log - * + * @name $log#debug + * * @description * Write a debug message */ @@ -9388,7 +9497,7 @@ function $LogProvider(){ // Note: reading logFn.apply throws an error in IE11 in IE8 document mode. // The reason behind this is that console.log has type "object" in IE8... try { - hasApply = !! logFn.apply; + hasApply = !!logFn.apply; } catch (e) {} if (hasApply) { @@ -9465,7 +9574,7 @@ function ensureSafeObject(obj, fullExpression) { 'Referencing the Window in Angular expressions is disallowed! Expression: {0}', fullExpression); } else if (// isElement(obj) - obj.children && (obj.nodeName || (obj.on && obj.find))) { + obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) { throw $parseMinErr('isecdom', 'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}', fullExpression); @@ -10195,6 +10304,10 @@ Parser.prototype = { var allConstant = true; if (this.peekToken().text !== ']') { do { + if (this.peek(']')) { + // Support trailing commas per ES5.1. + break; + } var elementFn = this.expression(); elementFns.push(elementFn); if (!elementFn.constant) { @@ -10221,6 +10334,10 @@ Parser.prototype = { var allConstant = true; if (this.peekToken().text !== '}') { do { + if (this.peek('}')) { + // Support trailing commas per ES5.1. + break; + } var token = this.expect(), key = token.string || token.text; this.consume(':'); @@ -10493,15 +10610,15 @@ function getterFn(path, options, fullExp) { /////////////////////////////////// /** - * @ngdoc function - * @name ng.$parse - * @function + * @ngdoc service + * @name $parse + * @kind function * * @description * * Converts Angular {@link guide/expression expression} into a function. * - *
+ * ```js
  *   var getter = $parse('user.name');
  *   var setter = getter.assign;
  *   var context = {user:{name:'angular'}};
@@ -10511,7 +10628,7 @@ function getterFn(path, options, fullExp) {
  *   setter(context, 'newValue');
  *   expect(context.user.name).toEqual('newValue');
  *   expect(getter(context, locals)).toEqual('local');
- * 
+ * ``` * * * @param {string} expression String expression to compile. @@ -10534,8 +10651,8 @@ function getterFn(path, options, fullExp) { /** - * @ngdoc object - * @name ng.$parseProvider + * @ngdoc provider + * @name $parseProvider * @function * * @description @@ -10556,8 +10673,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** @@ -10611,8 +10727,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. @@ -10679,7 +10794,7 @@ function $ParseProvider() { /** * @ngdoc service - * @name ng.$q + * @name $q * @requires $rootScope * * @description @@ -10692,10 +10807,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();
  *
@@ -10724,7 +10839,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 @@ -10750,7 +10865,7 @@ function $ParseProvider() { * constructed via `$q.reject`, the promise will be rejected instead. * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to * resolving it with a rejection constructed via `$q.reject`. - * - `notify(value)` - provides updates on the status of the promises execution. This may be called + * - `notify(value)` - provides updates on the status of the promise's execution. This may be called * multiple times before the promise is either resolved or rejected. * * **Properties** @@ -10796,14 +10911,14 @@ function $ParseProvider() { * 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 @@ -10823,7 +10938,7 @@ function $ParseProvider() { * * # Testing * - *
+ *  ```js
  *    it('should simulate promise', inject(function($q, $rootScope) {
  *      var deferred = $q.defer();
  *      var promise = deferred.promise;
@@ -10843,7 +10958,7 @@ function $ParseProvider() {
  *      $rootScope.$apply();
  *      expect(resolvedValue).toEqual(123);
  *    }));
- *  
+ * ``` */ function $QProvider() { @@ -10858,7 +10973,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. @@ -10866,9 +10981,10 @@ function $QProvider() { function qFactory(nextTick, exceptionHandler) { /** - * @ngdoc - * @name ng.$q#defer - * @methodOf ng.$q + * @ngdoc method + * @name $q#defer + * @function + * * @description * Creates a `Deferred` object which represents a task which will finish in the future. * @@ -10900,7 +11016,7 @@ function qFactory(nextTick, exceptionHandler) { reject: function(reason) { - deferred.resolve(reject(reason)); + deferred.resolve(createInternalRejectedPromise(reason)); }, @@ -11022,9 +11138,10 @@ function qFactory(nextTick, exceptionHandler) { /** - * @ngdoc - * @name ng.$q#reject - * @methodOf ng.$q + * @ngdoc method + * @name $q#reject + * @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 @@ -11036,7 +11153,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
@@ -11051,12 +11168,18 @@ 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`. */ var reject = function(reason) { + var result = defer(); + result.reject(reason); + return result.promise; + }; + + var createInternalRejectedPromise = function(reason) { return { then: function(callback, errback) { var result = defer(); @@ -11075,9 +11198,10 @@ function qFactory(nextTick, exceptionHandler) { /** - * @ngdoc - * @name ng.$q#when - * @methodOf ng.$q + * @ngdoc method + * @name $q#when + * @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 @@ -11146,9 +11270,10 @@ function qFactory(nextTick, exceptionHandler) { /** - * @ngdoc - * @name ng.$q#all - * @methodOf ng.$q + * @ngdoc method + * @name $q#all + * @function + * * @description * Combines multiple promises into a single promise that is resolved when all of the input * promises are resolved. @@ -11191,6 +11316,27 @@ function qFactory(nextTick, exceptionHandler) { }; } +function $$RAFProvider(){ //rAF + this.$get = ['$window', function($window) { + var requestAnimationFrame = $window.requestAnimationFrame || + $window.webkitRequestAnimationFrame; + + var cancelAnimationFrame = $window.cancelAnimationFrame || + $window.webkitCancelAnimationFrame; + + var raf = function(fn) { + var id = requestAnimationFrame(fn); + return function() { + cancelAnimationFrame(id); + }; + }; + + raf.supported = !!requestAnimationFrame; + + return raf; + }]; +} + /** * DESIGN NOTES * @@ -11218,17 +11364,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 @@ -11249,8 +11394,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}. @@ -11275,23 +11420,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();
 
@@ -11302,7 +11447,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 @@ -11330,7 +11475,7 @@ function $RootScopeProvider(){ /** * @ngdoc property - * @name ng.$rootScope.Scope#$id + * @name $rootScope.Scope#$id * @propertyOf ng.$rootScope.Scope * @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for * debugging. @@ -11340,19 +11485,18 @@ function $RootScopeProvider(){ Scope.prototype = { constructor: Scope, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$new - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$new * @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. * @@ -11398,19 +11542,18 @@ function $RootScopeProvider(){ }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$watch - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$watch * @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 @@ -11422,13 +11565,13 @@ function $RootScopeProvider(){ * 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 @@ -11438,7 +11581,7 @@ function $RootScopeProvider(){ * * * # Example - *
+       * ```js
            // let's assume that scope was dependency injected as the $rootScope
            var scope = $rootScope;
            scope.name = 'misko';
@@ -11487,12 +11630,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} @@ -11550,9 +11693,8 @@ function $RootScopeProvider(){ /** - * @ngdoc function - * @name ng.$rootScope.Scope#$watchCollection - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$watchCollection * @function * * @description @@ -11567,7 +11709,7 @@ function $RootScopeProvider(){ * * * # Example - *
+       * ```js
           $scope.names = ['igor', 'matias', 'misko', 'james'];
           $scope.dataCount = 4;
 
@@ -11586,12 +11728,12 @@ 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 @@ -11690,33 +11832,32 @@ function $RootScopeProvider(){ }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$digest - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$digest * @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;
@@ -11734,7 +11875,7 @@ function $RootScopeProvider(){
            scope.name = 'adam';
            scope.$digest();
            expect(scope.counter).toEqual(1);
-       * 
+ * ``` * */ $digest: function() { @@ -11847,7 +11988,7 @@ function $RootScopeProvider(){ /** * @ngdoc event - * @name ng.$rootScope.Scope#$destroy + * @name $rootScope.Scope#$destroy * @eventOf ng.$rootScope.Scope * @eventType broadcast on scope being destroyed * @@ -11859,14 +12000,13 @@ function $RootScopeProvider(){ */ /** - * @ngdoc function - * @name ng.$rootScope.Scope#$destroy - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$destroy * @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. * @@ -11904,9 +12044,8 @@ function $RootScopeProvider(){ }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$eval - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$eval * @function * * @description @@ -11915,14 +12054,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. * @@ -11937,9 +12076,8 @@ function $RootScopeProvider(){ }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$evalAsync - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$evalAsync * @function * * @description @@ -11950,7 +12088,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 @@ -11985,9 +12123,8 @@ function $RootScopeProvider(){ }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$apply - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$apply * @function * * @description @@ -11995,12 +12132,12 @@ function $RootScopeProvider(){ * 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);
@@ -12010,17 +12147,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. @@ -12048,13 +12185,12 @@ function $RootScopeProvider(){ }, /** - * @ngdoc function - * @name ng.$rootScope.Scope#$on - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$on * @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 @@ -12098,27 +12234,26 @@ function $RootScopeProvider(){ /** - * @ngdoc function - * @name ng.$rootScope.Scope#$emit - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$emit * @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 set of arguments which will be passed onto the event listeners. - * @return {Object} Event object (see {@link ng.$rootScope.Scope#methods_$on}). + * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. + * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}). */ $emit: function(name, args) { var empty = [], @@ -12167,26 +12302,25 @@ function $RootScopeProvider(){ /** - * @ngdoc function - * @name ng.$rootScope.Scope#$broadcast - * @methodOf ng.$rootScope.Scope + * @ngdoc method + * @name $rootScope.Scope#$broadcast * @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 set of arguments which will be passed onto the event listeners. - * @return {Object} Event object, see {@link ng.$rootScope.Scope#methods_$on} + * @param {...*} args Optional one or more arguments which will be passed onto the event listeners. + * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on} */ $broadcast: function(name, args) { var target = this, @@ -12417,7 +12551,7 @@ function adjustMatchers(matchers) { /** * @ngdoc service - * @name ng.$sceDelegate + * @name $sceDelegate * @function * * @description @@ -12437,21 +12571,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)}. @@ -12488,9 +12622,8 @@ function $SceDelegateProvider() { resourceUrlBlacklist = []; /** - * @ngdoc function - * @name ng.sceDelegateProvider#resourceUrlWhitelist - * @methodOf ng.$sceDelegateProvider + * @ngdoc method + * @name $sceDelegateProvider#resourceUrlWhitelist * @function * * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value @@ -12518,9 +12651,8 @@ function $SceDelegateProvider() { }; /** - * @ngdoc function - * @name ng.sceDelegateProvider#resourceUrlBlacklist - * @methodOf ng.$sceDelegateProvider + * @ngdoc method + * @name $sceDelegateProvider#resourceUrlBlacklist * @function * * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value @@ -12623,8 +12755,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 @@ -12661,20 +12792,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. */ @@ -12688,18 +12818,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) { @@ -12735,8 +12864,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. @@ -12750,7 +12879,7 @@ function $SceDelegateProvider() { /** * @ngdoc service - * @name ng.$sce + * @name $sce * @function * * @description @@ -12804,20 +12933,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): * *
@@ -12836,15 +12965,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
@@ -12859,14 +12988,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 @@ -12883,7 +13012,7 @@ function $SceDelegateProvider() { * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contens are also safe to include in your application. Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)

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: * @@ -12895,10 +13024,10 @@ 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. @@ -12977,13 +13106,15 @@ function $SceDelegateProvider() { ] - + describe('SCE doc demo', function() { it('should sanitize untrusted values', function() { - expect(element('.htmlComment').html()).toBe('Is anyone reading this?'); + expect(element(by.css('.htmlComment')).getInnerHtml()) + .toBe('Is anyone reading this?'); }); + it('should NOT sanitize explicitly trusted values', function() { - expect(element('#explicitlyTrustedHtml').html()).toBe( + expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe( 'Hover over this text.'); }); @@ -13018,9 +13149,8 @@ function $SceProvider() { var enabled = true; /** - * @ngdoc function - * @name ng.sceProvider#enabled - * @methodOf ng.$sceProvider + * @ngdoc method + * @name $sceProvider#enabled * @function * * @param {boolean=} value If provided, then enables/disables SCE. @@ -13097,9 +13227,8 @@ function $SceProvider() { var sce = copy(SCE_CONTEXTS); /** - * @ngdoc function - * @name ng.sce#isEnabled - * @methodOf ng.$sce + * @ngdoc method + * @name $sce#isEnabled * @function * * @return {Boolean} true if SCE is enabled, false otherwise. If you want to set the value, you @@ -13122,13 +13251,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. @@ -13153,11 +13281,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.) @@ -13173,95 +13300,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)` @@ -13269,12 +13390,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)` @@ -13282,12 +13402,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)` @@ -13295,12 +13414,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)` @@ -13308,12 +13426,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)` @@ -13321,12 +13438,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: @@ -13339,12 +13455,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: @@ -13357,12 +13472,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: @@ -13375,12 +13489,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: @@ -13393,12 +13506,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: @@ -13434,7 +13546,7 @@ function $SceProvider() { /** * !!! This is an undocumented "private" service !!! * - * @name ng.$sniffer + * @name $sniffer * @requires $window * @requires $document * @@ -13530,9 +13642,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 @@ -13550,10 +13661,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(), @@ -13583,9 +13694,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 @@ -13712,8 +13822,8 @@ function urlIsSameOrigin(requestUrl) { } /** - * @ngdoc object - * @name ng.$window + * @ngdoc service + * @name $window * * @description * A reference to the browser's `window` object. While `window` @@ -13727,8 +13837,8 @@ function urlIsSameOrigin(requestUrl) { * expression. * * @example - - + +

- default currency symbol ($): {{amount | currency}}
- custom currency identifier (USD$): {{amount | currency:"USD$"}} + default currency symbol ($): {{amount | currency}}
+ custom currency identifier (USD$): {{amount | currency:"USD$"}}
-
- +
+ it('should init with 1234.56', function() { - expect(binding('amount | currency')).toBe('$1,234.56'); - expect(binding('amount | currency:"USD$"')).toBe('USD$1,234.56'); + expect(element(by.id('currency-default')).getText()).toBe('$1,234.56'); + expect(element(by.binding('amount | currency:"USD$"')).getText()).toBe('USD$1,234.56'); }); it('should update', function() { - input('amount').enter('-1234'); - expect(binding('amount | currency')).toBe('($1,234.00)'); - expect(binding('amount | currency:"USD$"')).toBe('(USD$1,234.00)'); + if (browser.params.browser == 'safari') { + // Safari does not understand the minus key. See + // https://github.com/angular/protractor/issues/481 + return; + } + element(by.model('amount')).clear(); + element(by.model('amount')).sendKeys('-1234'); + expect(element(by.id('currency-default')).getText()).toBe('($1,234.00)'); + expect(element(by.binding('amount | currency:"USD$"')).getText()).toBe('(USD$1,234.00)'); }); - - + + */ currencyFilter.$inject = ['$locale']; function currencyFilter($locale) { @@ -14138,7 +14273,7 @@ function currencyFilter($locale) { /** * @ngdoc filter - * @name ng.filter:number + * @name number * @function * * @description @@ -14153,8 +14288,8 @@ function currencyFilter($locale) { * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit. * * @example - - + +
Enter number:
- Default formatting: {{val | number}}
- No fractions: {{val | number:0}}
- Negative number: {{-val | number:4}} + Default formatting: {{val | number}}
+ No fractions: {{val | number:0}}
+ Negative number: {{-val | number:4}}
-
- +
+ it('should format numbers', function() { - expect(binding('val | number')).toBe('1,234.568'); - expect(binding('val | number:0')).toBe('1,235'); - expect(binding('-val | number:4')).toBe('-1,234.5679'); + expect(element(by.id('number-default')).getText()).toBe('1,234.568'); + expect(element(by.binding('val | number:0')).getText()).toBe('1,235'); + expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679'); }); it('should update', function() { - input('val').enter('3374.333'); - expect(binding('val | number')).toBe('3,374.333'); - expect(binding('val | number:0')).toBe('3,374'); - expect(binding('-val | number:4')).toBe('-3,374.3330'); - }); - - + element(by.model('val')).clear(); + element(by.model('val')).sendKeys('3374.333'); + expect(element(by.id('number-default')).getText()).toBe('3,374.333'); + expect(element(by.binding('val | number:0')).getText()).toBe('3,374'); + expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330'); + }); + + */ @@ -14196,7 +14332,7 @@ function numberFilter($locale) { var DECIMAL_SEP = '.'; function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { - if (isNaN(number) || !isFinite(number)) return ''; + if (number == null || !isFinite(number) || isObject(number)) return ''; var isNegative = number < 0; number = Math.abs(number); @@ -14349,7 +14485,7 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+ /** * @ngdoc filter - * @name ng.filter:date + * @name date * @function * * @description @@ -14407,26 +14543,26 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+ * @returns {string} Formatted string or the input if input is not recognized as date/millis. * * @example - - + + {{1288323623006 | date:'medium'}}: - {{1288323623006 | date:'medium'}}
+ {{1288323623006 | date:'medium'}}
{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}: - {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}
+ {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}
{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}: - {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}
-
- + {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}
+ + it('should format date', function() { - expect(binding("1288323623006 | date:'medium'")). + expect(element(by.binding("1288323623006 | date:'medium'")).getText()). toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/); - expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")). + expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()). toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/); - expect(binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")). + expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()). toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/); }); -
-
+ + */ dateFilter.$inject = ['$locale']; function dateFilter($locale) { @@ -14506,7 +14642,7 @@ function dateFilter($locale) { /** * @ngdoc filter - * @name ng.filter:json + * @name json * @function * * @description @@ -14520,16 +14656,16 @@ function dateFilter($locale) { * * * @example: - - + +
{{ {'name':'value'} | json }}
-
- + + it('should jsonify filtered objects', function() { - expect(binding("{'name':'value'}")).toMatch(/\{\n "name": ?"value"\n}/); + expect(element(by.binding("{'name':'value'}")).getText()).toMatch(/\{\n "name": ?"value"\n}/); }); - -
+ + * */ function jsonFilter() { @@ -14541,7 +14677,7 @@ function jsonFilter() { /** * @ngdoc filter - * @name ng.filter:lowercase + * @name lowercase * @function * @description * Converts string to lowercase. @@ -14552,7 +14688,7 @@ var lowercaseFilter = valueFn(lowercase); /** * @ngdoc filter - * @name ng.filter:uppercase + * @name uppercase * @function * @description * Converts string to uppercase. @@ -14561,8 +14697,8 @@ var lowercaseFilter = valueFn(lowercase); var uppercaseFilter = valueFn(uppercase); /** - * @ngdoc function - * @name ng.filter:limitTo + * @ngdoc filter + * @name limitTo * @function * * @description @@ -14571,16 +14707,16 @@ var uppercaseFilter = valueFn(uppercase); * the value and sign (positive or negative) of `limit`. * * @param {Array|string} input Source array or string to be limited. - * @param {string|number} limit The length of the returned array or string. If the `limit` number + * @param {string|number} limit The length of the returned array or string. If the `limit` number * is positive, `limit` number of items from the beginning of the source array/string are copied. - * If the number is negative, `limit` number of items from the end of the source array/string + * If the number is negative, `limit` number of items from the end of the source array/string * are copied. The `limit` will be trimmed if it exceeds `array.length` * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array * had less than `limit` elements. * * @example - - + + - + + userType: Required!
userType = {{userType}}
@@ -15527,20 +15707,32 @@ function FormController(element, attrs) { myForm.$valid = {{myForm.$valid}}
myForm.$error.required = {{!!myForm.$error.required}}
-
- + + it('should initialize to model', function() { - expect(binding('userType')).toEqual('guest'); - expect(binding('myForm.input.$valid')).toEqual('true'); + var userType = element(by.binding('userType')); + var valid = element(by.binding('myForm.input.$valid')); + + expect(userType.getText()).toContain('guest'); + expect(valid.getText()).toContain('true'); }); it('should be invalid if empty', function() { - input('userType').enter(''); - expect(binding('userType')).toEqual(''); - expect(binding('myForm.input.$valid')).toEqual('false'); + var userType = element(by.binding('userType')); + var valid = element(by.binding('myForm.input.$valid')); + var userInput = element(by.model('userType')); + + userInput.clear(); + userInput.sendKeys(''); + + expect(userType.getText()).toEqual('userType ='); + expect(valid.getText()).toContain('false'); }); - -
+ + + * + * @param {string=} name Name of the form. If specified, the form controller will be published into + * related scope, under this name. */ var formDirectiveFactory = function(isNgForm) { return ['$timeout', function($timeout) { @@ -15617,8 +15809,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. @@ -15641,8 +15833,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 { @@ -16794,7 +17128,7 @@ var ngModelDirective = function() { /** * @ngdoc directive - * @name ng.directive:ngChange + * @name ngChange * * @description * Evaluate the given expression when the user changes the input. @@ -16810,8 +17144,8 @@ var ngModelDirective = function() { * in input value. * * @example - * - * + * + * * Load inlined template
-
- + + it('should load template defined inside script tag', function() { - element('#tpl-link').click(); - expect(element('#tpl-content').text()).toMatch(/Content of the template/); + element(by.css('#tpl-link')).click(); + expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/); }); - -
+ + */ var scriptDirective = ['$templateCache', function($templateCache) { return { @@ -19949,7 +20406,7 @@ var scriptDirective = ['$templateCache', function($templateCache) { var ngOptionsMinErr = minErr('ngOptions'); /** * @ngdoc directive - * @name ng.directive:select + * @name select * @restrict E * * @description @@ -19967,7 +20424,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 `