diff --git a/grunt.js b/grunt.js index e643008048..3acff5e7c0 100644 --- a/grunt.js +++ b/grunt.js @@ -7,7 +7,7 @@ module.exports = function(grunt) { grunt.initConfig({ modules: '', //to be filled in by find-modules task tplModules: '', //to be filled in by find-templates task - ngversion: '1.0.3', + ngversion: '1.0.4', pkg:'', meta: { modules: 'angular.module("ui.bootstrap", [<%= modules %>]);', diff --git a/misc/demo-assets/plunker.js b/misc/demo-assets/plunker.js index 982c5f483f..b183491122 100644 --- a/misc/demo-assets/plunker.js +++ b/misc/demo-assets/plunker.js @@ -2,7 +2,7 @@ angular.module('plunker', []) .factory('plunkGenerator', function ($document) { - return function (version, module, content) { + return function (ngVersion, version, module, content) { var form = angular.element('
'); var addField = function (name, value) { @@ -15,7 +15,7 @@ angular.module('plunker', []) return '\n' + '\n' + ' \n' + - ' \n' + + ' \n' + ' \n' + ' \n' + ' \n' + @@ -44,8 +44,8 @@ angular.module('plunker', []) $scope.content = {}; - $scope.edit = function (version, module, plunker) { - plunkGenerator(version, module, $scope.content); + $scope.edit = function (ngVersion, version, module) { + plunkGenerator(ngVersion, version, module, $scope.content); }; }) diff --git a/misc/demo-template.html b/misc/demo-template.html index f4cba59f5b..ed0c51a7fb 100644 --- a/misc/demo-template.html +++ b/misc/demo-template.html @@ -121,7 +121,7 @@

<%= module.displayName %>

- +
<%- module.html %>
diff --git a/misc/test-lib/angular-mocks.js b/misc/test-lib/angular-mocks.js index aad5452b89..6e04a27a5b 100644 --- a/misc/test-lib/angular-mocks.js +++ b/misc/test-lib/angular-mocks.js @@ -1,6 +1,5 @@ - /** - * @license AngularJS v1.0.3 + * @license AngularJS v1.0.4 * (c) 2010-2012 Google, Inc. http://angularjs.org * License: MIT * @@ -203,6 +202,30 @@ angular.mock.$Browser.prototype = { * Mock implementation of {@link ng.$exceptionHandler} that rethrows or logs errors passed * into it. See {@link ngMock.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration * information. + * + * + *
+ *   describe('$exceptionHandlerProvider', function() {
+ *
+ *     it('should capture log messages and exceptions', function() {
+ *
+ *       module(function($exceptionHandlerProvider) {
+ *         $exceptionHandlerProvider.mode('log');
+ *       });
+ *
+ *       inject(function($log, $exceptionHandler, $timeout) {
+ *         $timeout(function() { $log.log(1); });
+ *         $timeout(function() { $log.log(2); throw 'banana peel'; });
+ *         $timeout(function() { $log.log(3); });
+ *         expect($exceptionHandler.errors).toEqual([]);
+ *         expect($log.assertEmpty());
+ *         $timeout.flush();
+ *         expect($exceptionHandler.errors).toEqual(['banana peel']);
+ *         expect($log.log.logs).toEqual([[1], [2], [3]]);
+ *       });
+ *     });
+ *   });
+ * 
*/ angular.mock.$ExceptionHandlerProvider = function() { @@ -221,8 +244,8 @@ angular.mock.$ExceptionHandlerProvider = function() { * - `rethrow`: If any errors are are passed into the handler in tests, it typically * means that there is a bug in the application or test, so this mock will * make these tests fail. - * - `log`: Sometimes it is desirable to test that an error is throw, for this case the `log` mode stores the - * error and allows later assertion of it. + * - `log`: Sometimes it is desirable to test that an error is throw, for this case the `log` mode stores an + * array of errors in `$exceptionHandler.errors`, to allow later assertion of them. * See {@link ngMock.$log#assertEmpty assertEmpty()} and * {@link ngMock.$log#reset reset()} */ @@ -562,7 +585,7 @@ angular.mock.$LogProvider = function() { /** * @ngdoc function - * @name angular.mock.debug + * @name angular.mock.dump * @description * * *NOTE*: this is not an injectable instance, just a globally available function. @@ -745,7 +768,7 @@ angular.mock.dump = function(object) { } // testing controller - var $http; + var $httpBackend; beforeEach(inject(function($injector) { $httpBackend = $injector.get('$httpBackend'); diff --git a/misc/test-lib/angular.js b/misc/test-lib/angular.js index a19e106bd7..0b8b39aae6 100644 --- a/misc/test-lib/angular.js +++ b/misc/test-lib/angular.js @@ -1,5 +1,5 @@ /** - * @license AngularJS v1.0.4-331f32de + * @license AngularJS v1.0.4 * (c) 2010-2012 Google, Inc. http://angularjs.org * License: MIT */ @@ -627,13 +627,15 @@ function equals(o1, o2) { if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2)) return false; keySet = {}; for(key in o1) { - if (key.charAt(0) !== '$' && !isFunction(o1[key]) && !equals(o1[key], o2[key])) { - return false; - } + if (key.charAt(0) === '$' || isFunction(o1[key])) continue; + if (!equals(o1[key], o2[key])) return false; keySet[key] = true; } for(key in o2) { - if (!keySet[key] && key.charAt(0) !== '$' && !isFunction(o2[key])) return false; + if (!keySet[key] && + key.charAt(0) !== '$' && + o2[key] !== undefined && + !isFunction(o2[key])) return false; } return true; } @@ -1240,14 +1242,14 @@ function setupModuleLoader(window) { * An object that contains information about the current AngularJS version. This object has the * following properties: * - * - `full` – `{string}` – Full version string, such as "0.9.18". - * - `major` – `{number}` – Major version number, such as "0". - * - `minor` – `{number}` – Minor version number, such as "9". - * - `dot` – `{number}` – Dot version number, such as "18". - * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". + * - `full` – `{string}` – Full version string, such as "0.9.18". + * - `major` – `{number}` – Major version number, such as "0". + * - `minor` – `{number}` – Minor version number, such as "9". + * - `dot` – `{number}` – Dot version number, such as "18". + * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". */ var version = { - full: '1.0.4-331f32de', // all of these placeholder strings will be replaced by rake's + full: '1.0.4', // all of these placeholder strings will be replaced by rake's major: 1, // compile task minor: 0, dot: 4, @@ -1423,7 +1425,7 @@ function publishExternalAPI(angular){ * - [val()](http://api.jquery.com/val/) * - [wrap()](http://api.jquery.com/wrap/) * - * ## In addtion to the above, Angular privides an additional method to both jQuery and jQuery lite: + * ## In addtion to the above, Angular provides additional methods to both jQuery and jQuery lite: * * - `controller(name)` - retrieves the controller of the current element or its parent. By default * retrieves controller associated with the `ngController` directive. If `name` is provided as @@ -3277,16 +3279,16 @@ function $BrowserProvider(){ * @param {string} cacheId Name or id of the newly created cache. * @param {object=} options Options object that specifies the cache behavior. Properties: * - * - `{number=}` `capacity` — turns the cache into LRU cache. + * - `{number=}` `capacity` — turns the cache into LRU cache. * * @returns {object} Newly created cache object with the following set of methods: * - * - `{object}` `info()` — Returns id, size, and options of cache. - * - `{void}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache. - * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss. - * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache. - * - `{void}` `removeAll()` — Removes all cached values. - * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory. + * - `{object}` `info()` — Returns id, size, and options of cache. + * - `{void}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache. + * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss. + * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache. + * - `{void}` `removeAll()` — Removes all cached values. + * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory. * */ function $CacheFactoryProvider() { @@ -3804,68 +3806,74 @@ function $CompileProvider($provide) { * @returns {?function} A composite linking function of all of the matched directives or null. */ function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority) { - var linkFns = [], - nodeLinkFn, childLinkFn, directives, attrs, linkFnFound; + var linkFns = [], + nodeLinkFn, childLinkFn, directives, attrs, linkFnFound; - for(var i = 0; i < nodeList.length; i++) { - attrs = new Attributes(); + for(var i = 0; i < nodeList.length; i++) { + attrs = new Attributes(); - // we must always refer to nodeList[i] since the nodes can be replaced underneath us. - directives = collectDirectives(nodeList[i], [], attrs, maxPriority); + // we must always refer to nodeList[i] since the nodes can be replaced underneath us. + directives = collectDirectives(nodeList[i], [], attrs, maxPriority); - nodeLinkFn = (directives.length) - ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement) - : null; + nodeLinkFn = (directives.length) + ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement) + : null; - childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes.length) - ? null - : compileNodes(nodeList[i].childNodes, - nodeLinkFn ? nodeLinkFn.transclude : transcludeFn); + childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes.length) + ? null + : compileNodes(nodeList[i].childNodes, + nodeLinkFn ? nodeLinkFn.transclude : transcludeFn); - linkFns.push(nodeLinkFn); - linkFns.push(childLinkFn); - linkFnFound = (linkFnFound || nodeLinkFn || childLinkFn); - } + linkFns.push(nodeLinkFn); + linkFns.push(childLinkFn); + linkFnFound = (linkFnFound || nodeLinkFn || childLinkFn); + } + + // return a linking function if we have found anything, null otherwise + return linkFnFound ? compositeLinkFn : null; - // return a linking function if we have found anything, null otherwise - return linkFnFound ? compositeLinkFn : null; + function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) { + var nodeLinkFn, childLinkFn, node, childScope, childTranscludeFn, i, ii, n; - function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) { - var nodeLinkFn, childLinkFn, node, childScope, childTranscludeFn; + // copy nodeList so that linking doesn't break due to live list updates. + var stableNodeList = []; + for (i = 0, ii = nodeList.length; i < ii; i++) { + stableNodeList.push(nodeList[i]); + } - for(var i = 0, n = 0, ii = linkFns.length; i < ii; n++) { - node = nodeList[n]; - nodeLinkFn = linkFns[i++]; - childLinkFn = linkFns[i++]; + for(i = 0, n = 0, ii = linkFns.length; i < ii; n++) { + node = stableNodeList[n]; + nodeLinkFn = linkFns[i++]; + childLinkFn = linkFns[i++]; - if (nodeLinkFn) { - if (nodeLinkFn.scope) { - childScope = scope.$new(isObject(nodeLinkFn.scope)); - jqLite(node).data('$scope', childScope); - } else { - childScope = scope; - } - childTranscludeFn = nodeLinkFn.transclude; - if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) { - nodeLinkFn(childLinkFn, childScope, node, $rootElement, - (function(transcludeFn) { - return function(cloneFn) { - var transcludeScope = scope.$new(); - - return transcludeFn(transcludeScope, cloneFn). - bind('$destroy', bind(transcludeScope, transcludeScope.$destroy)); + if (nodeLinkFn) { + if (nodeLinkFn.scope) { + childScope = scope.$new(isObject(nodeLinkFn.scope)); + jqLite(node).data('$scope', childScope); + } else { + childScope = scope; + } + childTranscludeFn = nodeLinkFn.transclude; + if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) { + nodeLinkFn(childLinkFn, childScope, node, $rootElement, + (function(transcludeFn) { + return function(cloneFn) { + var transcludeScope = scope.$new(); + + return transcludeFn(transcludeScope, cloneFn). + bind('$destroy', bind(transcludeScope, transcludeScope.$destroy)); }; })(childTranscludeFn || transcludeFn) - ); - } else { - nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn); - } - } else if (childLinkFn) { - childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn); - } - } - } - } + ); + } else { + nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn); + } + } else if (childLinkFn) { + childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn); + } + } + } + } /** @@ -4677,11 +4685,12 @@ function $DocumentProvider(){ * the browser console. * * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by - * {@link ngMock.$exceptionHandler mock $exceptionHandler} + * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing. * * @param {Error} exception Exception associated with the error. * @param {string=} cause optional information about the context in which * the error was thrown. + * */ function $ExceptionHandlerProvider() { this.$get = ['$log', function($log){ @@ -6532,14 +6541,14 @@ function $ParseProvider() { * * **Methods** * - * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection + * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection * constructed via `$q.reject`, the promise will be rejected instead. - * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to + * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to * resolving it with a rejection constructed via `$q.reject`. * * **Properties** * - * - promise – `{Promise}` – promise object associated with this deferred. + * - promise – `{Promise}` – promise object associated with this deferred. * * * # The Promise API @@ -6552,7 +6561,7 @@ function $ParseProvider() { * * **Methods** * - * - `then(successCallback, errorCallback)` – regardless of when the promise was or will be resolved + * - `then(successCallback, errorCallback)` – regardless of when the promise was or will be resolved * or rejected calls one of the success or error callbacks asynchronously as soon as the result * is available. The callbacks are called with a single argument the result or rejection reason. * @@ -6591,6 +6600,30 @@ function $ParseProvider() { * you can treat promises attached to a scope as if they were the resulting values. * - Q has many more features that $q, but that comes at a cost of bytes. $q is tiny, but contains * all the important functionality needed for common async tasks. + * + * # Testing + * + *
+ *    it('should simulate promise', inject(function($q, $rootSCope) {
+ *      var deferred = $q.defer();
+ *      var promise = deferred.promise;
+ *      var resolvedValue;
+ * 
+ *      promise.then(function(value) { resolvedValue = value; });
+ *      expect(resolvedValue).toBeUndefined();
+ * 
+ *      // Simulate resolving of promise
+ *      defered.resolve(123);
+ *      // Note that the 'then' function does not get called synchronously.
+ *      // This is because we want the promise API to always be async, whether or not
+ *      // it got called synchronously or asynchronously.
+ *      expect(resolvedValue).toBeUndefined();
+ * 
+ *      // Propagate promise resolution to 'then' functions using $apply().
+ *      $rootScope.$apply();
+ *      expect(resolvedValue).toEqual(123);
+ *    });
+ *  
*/ function $QProvider() { @@ -6889,27 +6922,27 @@ function $RouteProvider(){ * * Object properties: * - * - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly + * - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly * created scope or the name of a {@link angular.Module#controller registered controller} * if passed as a string. - * - `template` – `{string=}` – html template as a string that should be used by + * - `template` – `{string=}` – html template as a string that should be used by * {@link ng.directive:ngView ngView} or * {@link ng.directive:ngInclude ngInclude} directives. * this property takes precedence over `templateUrl`. - * - `templateUrl` – `{string=}` – path to an html template that should be used by + * - `templateUrl` – `{string=}` – path to an html template that should be used by * {@link ng.directive:ngView ngView}. * - `resolve` - `{Object.=}` - An optional map of dependencies which should * be injected into the controller. If any of these dependencies are promises, they will be * resolved and converted to a value before the controller is instantiated and the * `$routeChangeSuccess` event is fired. The map object is: * - * - `key` – `{string}`: a name of a dependency to be injected into the controller. + * - `key` – `{string}`: a name of a dependency to be injected into the controller. * - `factory` - `{string|function}`: If `string` then it is an alias for a service. * Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected} * and the return value is treated as the dependency. If the result is a promise, it is resolved * before its value is injected into the controller. * - * - `redirectTo` – {(string|function())=} – value to update + * - `redirectTo` – {(string|function())=} – value to update * {@link ng.$location $location} path with and trigger route redirection. * * If `redirectTo` is a function, it will be called with the following parameters: @@ -7446,7 +7479,7 @@ function $RootScopeProvider(){ expect(scope.greeting).toEqual(undefined); scope.$watch('name', function() { - this.greeting = this.salutation + ' ' + this.name + '!'; + scope.greeting = scope.salutation + ' ' + scope.name + '!'; }); // initialize the watch expect(scope.greeting).toEqual(undefined); @@ -7608,7 +7641,7 @@ function $RootScopeProvider(){ scope.counter = 0; expect(scope.counter).toEqual(0); - scope.$watch('name', function(newValue, oldValue) { counter = counter + 1; }); + scope.$watch('name', function(newValue, oldValue) { scope.counter = scope.counter + 1; }); expect(scope.counter).toEqual(0); scope.$digest(); @@ -7701,7 +7734,7 @@ function $RootScopeProvider(){ expect(scope.counter).toEqual(0); scope.$watch('name', function(newValue, oldValue) { - counter = counter + 1; + scope.counter = scope.counter + 1; }); expect(scope.counter).toEqual(0); @@ -8402,7 +8435,7 @@ function $HttpProvider() { * * * # General usage - * The `$http` service is a function which takes a single argument — a configuration object — + * The `$http` service is a function which takes a single argument — a configuration object — * that is used to generate an http request and returns a {@link ng.$q promise} * with two $http specific methods: `success` and `error`. * @@ -8419,7 +8452,7 @@ function $HttpProvider() { * * * Since the returned value of calling the $http function is a Promise object, you can also use - * the `then` method to register callbacks, and these callbacks will receive a single argument – + * the `then` method to register callbacks, and these callbacks will receive a single argument – * an object representing the response. See the api signature and type info below for more * details. * @@ -8520,7 +8553,7 @@ function $HttpProvider() { * * The interceptors are service factories that are registered with the $httpProvider by * adding them to the `$httpProvider.responseInterceptors` array. The factory is called and - * injected with dependencies (if specified) and returns the interceptor — a function that + * injected with dependencies (if specified) and returns the interceptor — a function that * takes a {@link ng.$q promise} and returns the original or a new promise. * *
@@ -8606,23 +8639,23 @@ function $HttpProvider() {
      * @param {object} config Object describing the request to be made and how it should be
      *    processed. The object has following properties:
      *
-     *    - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
-     *    - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
-     *    - **params** – `{Object.}` – Map of strings or objects which will be turned to
+     *    - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
+     *    - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
+     *    - **params** – `{Object.}` – Map of strings or objects which will be turned to
      *      `?key1=value1&key2=value2` after the url. If the value is not a string, it will be JSONified.
-     *    - **data** – `{string|Object}` – Data to be sent as the request message data.
-     *    - **headers** – `{Object}` – Map of strings representing HTTP headers to send to the server.
-     *    - **transformRequest** – `{function(data, headersGetter)|Array.}` –
+     *    - **data** – `{string|Object}` – Data to be sent as the request message data.
+     *    - **headers** – `{Object}` – Map of strings representing HTTP headers to send to the server.
+     *    - **transformRequest** – `{function(data, headersGetter)|Array.}` –
      *      transform function or an array of such functions. The transform function takes the http
      *      request body and headers and returns its transformed (typically serialized) version.
-     *    - **transformResponse** – `{function(data, headersGetter)|Array.}` –
+     *    - **transformResponse** – `{function(data, headersGetter)|Array.}` –
      *      transform function or an array of such functions. The transform function takes the http
      *      response body and headers and returns its transformed (typically deserialized) version.
-     *    - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
+     *    - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
      *      GET request, otherwise if a cache instance built with
      *      {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
      *      caching.
-     *    - **timeout** – `{number}` – timeout in milliseconds.
+     *    - **timeout** – `{number}` – timeout in milliseconds.
      *    - **withCredentials** - `{boolean}` - whether to to set the `withCredentials` flag on the
      *      XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5
      *      requests with credentials} for more information.
@@ -8635,10 +8668,10 @@ function $HttpProvider() {
      *   these functions are destructured representation of the response object passed into the
      *   `then` method. The response object has these properties:
      *
-     *   - **data** – `{string|Object}` – The response body transformed with the transform functions.
-     *   - **status** – `{number}` – HTTP status code of the response.
-     *   - **headers** – `{function([headerName])}` – Header getter function.
-     *   - **config** – `{Object}` – The configuration object that was used to generate the request.
+     *   - **data** – `{string|Object}` – The response body transformed with the transform functions.
+     *   - **status** – `{number}` – HTTP status code of the response.
+     *   - **headers** – `{function([headerName])}` – Header getter function.
+     *   - **config** – `{Object}` – The configuration object that was used to generate the request.
      *
      * @property {Array.} pendingRequests Array of config objects for currently pending
      *   requests. This is primarily meant to be used for debugging purposes.
@@ -9143,7 +9176,7 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
  * $locale service provides localization rules for various Angular components. As of right now the
  * only public api is:
  *
- * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
+ * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
  */
 function $LocaleProvider(){
   this.$get = function() {
@@ -9445,7 +9478,7 @@ function $FilterProvider($provide) {
        
Any:
Name only
- Phone only
+ Phone only
@@ -9619,7 +9652,7 @@ function currencyFilter($locale) { * * @param {number|string} number Number to format. * @param {(number|string)=} [fractionSize=2] Number of decimal places to round the number to. - * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit. + * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit. * * @example @@ -10606,7 +10639,7 @@ var nullFormCtrl = { * @property {Object} $error Is an object hash, containing references to all invalid controls or * forms, where: * - * - keys are validation tokens (error names) — such as `required`, `url` or `email`), + * - keys are validation tokens (error names) — such as `required`, `url` or `email`), * - values are arrays of controls or forms that are invalid with given error. * * @description @@ -12552,9 +12585,9 @@ var ngCloakDirective = ngDirective({ * * MVC components in angular: * - * * Model — The Model is data in scope properties; scopes are attached to the DOM. - * * View — The template (HTML with data bindings) is rendered into the View. - * * Controller — The `ngController` directive specifies a Controller class; the class has + * * Model — The Model is data in scope properties; scopes are attached to the DOM. + * * View — The template (HTML with data bindings) is rendered into the View. + * * Controller — The `ngController` directive specifies a Controller class; the class has * methods that typically express the business logic behind the application. * * Note that an alternative way to define controllers is via the `{@link ng.$route}` @@ -13306,10 +13339,10 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp * * Special properties are exposed on the local scope of each template instance, including: * - * * `$index` – `{number}` – iterator offset of the repeated element (0..length-1) - * * `$first` – `{boolean}` – true if the repeated element is first in the iterator. - * * `$middle` – `{boolean}` – true if the repeated element is between the first and last in the iterator. - * * `$last` – `{boolean}` – true if the repeated element is last in the iterator. + * * `$index` – `{number}` – iterator offset of the repeated element (0..length-1) + * * `$first` – `{boolean}` – true if the repeated element is first in the iterator. + * * `$middle` – `{boolean}` – true if the repeated element is between the first and last in the iterator. + * * `$last` – `{boolean}` – true if the repeated element is last in the iterator. * * * @element ANY @@ -13318,12 +13351,12 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. Two * formats are currently supported: * - * * `variable in expression` – where variable is the user defined loop variable and `expression` + * * `variable in expression` – where variable is the user defined loop variable and `expression` * is a scope expression giving the collection to enumerate. * * For example: `track in cd.tracks`. * - * * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers, + * * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers, * and `expression` is the scope expression giving the collection to enumerate. * * For example: `(name, age) in {'adam':10, 'amalie':12}`. @@ -13670,52 +13703,53 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) { var NG_SWITCH = 'ng-switch'; var ngSwitchDirective = valueFn({ restrict: 'EA', - compile: function(element, attr) { + require: 'ngSwitch', + controller: function ngSwitchController() { + this.cases = {}; + }, + link: function(scope, element, attr, ctrl) { var watchExpr = attr.ngSwitch || attr.on, - cases = {}; - - element.data(NG_SWITCH, cases); - return function(scope, element){ - var selectedTransclude, - selectedElement, - selectedScope; - - scope.$watch(watchExpr, function ngSwitchWatchAction(value) { - if (selectedElement) { - selectedScope.$destroy(); - selectedElement.remove(); - selectedElement = selectedScope = null; - } - if ((selectedTransclude = cases['!' + value] || cases['?'])) { - scope.$eval(attr.change); - selectedScope = scope.$new(); - selectedTransclude(selectedScope, function(caseElement) { - selectedElement = caseElement; - element.append(caseElement); - }); - } - }); - }; + selectedTransclude, + selectedElement, + selectedScope; + + scope.$watch(watchExpr, function ngSwitchWatchAction(value) { + if (selectedElement) { + selectedScope.$destroy(); + selectedElement.remove(); + selectedElement = selectedScope = null; + } + if ((selectedTransclude = ctrl.cases['!' + value] || ctrl.cases['?'])) { + scope.$eval(attr.change); + selectedScope = scope.$new(); + selectedTransclude(selectedScope, function(caseElement) { + selectedElement = caseElement; + element.append(caseElement); + }); + } + }); } }); var ngSwitchWhenDirective = ngDirective({ transclude: 'element', priority: 500, + require: '^ngSwitch', compile: function(element, attrs, transclude) { - var cases = element.inheritedData(NG_SWITCH); - assertArg(cases); - cases['!' + attrs.ngSwitchWhen] = transclude; + return function(scope, element, attr, ctrl) { + ctrl.cases['!' + attrs.ngSwitchWhen] = transclude; + }; } }); var ngSwitchDefaultDirective = ngDirective({ transclude: 'element', priority: 500, + require: '^ngSwitch', compile: function(element, attrs, transclude) { - var cases = element.inheritedData(NG_SWITCH); - assertArg(cases); - cases['?'] = transclude; + return function(scope, element, attr, ctrl) { + ctrl.cases['?'] = transclude; + }; } }); @@ -13998,7 +14032,7 @@ var scriptDirective = ['$templateCache', function($templateCache) { * Optionally `ngOptions` attribute can be used to dynamically generate a list of `
NamePhone