angularjs-rails 1.2.19 → 1.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.19
2
+ * @license AngularJS v1.2.20
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.2.19
2
+ * @license AngularJS v1.2.20
3
3
  * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -68,7 +68,7 @@ function minErr(module) {
68
68
  return match;
69
69
  });
70
70
 
71
- message = message + '\nhttp://errors.angularjs.org/1.2.19/' +
71
+ message = message + '\nhttp://errors.angularjs.org/1.2.20/' +
72
72
  (module ? module + '/' : '') + code;
73
73
  for (i = 2; i < arguments.length; i++) {
74
74
  message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
@@ -810,9 +810,9 @@ function isLeafNode (node) {
810
810
  * @returns {*} The copy or updated `destination`, if `destination` was specified.
811
811
  *
812
812
  * @example
813
- <example>
813
+ <example module="copyExample">
814
814
  <file name="index.html">
815
- <div ng-controller="Controller">
815
+ <div ng-controller="ExampleController">
816
816
  <form novalidate class="simple-form">
817
817
  Name: <input type="text" ng-model="user.name" /><br />
818
818
  E-mail: <input type="email" ng-model="user.email" /><br />
@@ -826,21 +826,22 @@ function isLeafNode (node) {
826
826
  </div>
827
827
 
828
828
  <script>
829
- function Controller($scope) {
830
- $scope.master= {};
829
+ angular.module('copyExample')
830
+ .controller('ExampleController', ['$scope', function($scope) {
831
+ $scope.master= {};
831
832
 
832
- $scope.update = function(user) {
833
- // Example with 1 argument
834
- $scope.master= angular.copy(user);
835
- };
833
+ $scope.update = function(user) {
834
+ // Example with 1 argument
835
+ $scope.master= angular.copy(user);
836
+ };
836
837
 
837
- $scope.reset = function() {
838
- // Example with 2 arguments
839
- angular.copy($scope.master, $scope.user);
840
- };
838
+ $scope.reset = function() {
839
+ // Example with 2 arguments
840
+ angular.copy($scope.master, $scope.user);
841
+ };
841
842
 
842
- $scope.reset();
843
- }
843
+ $scope.reset();
844
+ }]);
844
845
  </script>
845
846
  </file>
846
847
  </example>
@@ -1184,7 +1185,7 @@ function parseKeyValue(/**string*/keyValue) {
1184
1185
  key = tryDecodeURIComponent(key_value[0]);
1185
1186
  if ( isDefined(key) ) {
1186
1187
  var val = isDefined(key_value[1]) ? tryDecodeURIComponent(key_value[1]) : true;
1187
- if (!obj[key]) {
1188
+ if (!hasOwnProperty.call(obj, key)) {
1188
1189
  obj[key] = val;
1189
1190
  } else if(isArray(obj[key])) {
1190
1191
  obj[key].push(val);
@@ -1958,11 +1959,11 @@ function setupModuleLoader(window) {
1958
1959
  * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
1959
1960
  */
1960
1961
  var version = {
1961
- full: '1.2.19', // all of these placeholder strings will be replaced by grunt's
1962
+ full: '1.2.20', // all of these placeholder strings will be replaced by grunt's
1962
1963
  major: 1, // package task
1963
1964
  minor: 2,
1964
- dot: 19,
1965
- codeName: 'precognitive-flashbacks'
1965
+ dot: 20,
1966
+ codeName: 'accidental-beautification'
1966
1967
  };
1967
1968
 
1968
1969
 
@@ -5241,7 +5242,7 @@ function $TemplateCacheProvider() {
5241
5242
  * local name. Given `<widget my-attr="count = count + value">` and widget definition of
5242
5243
  * `scope: { localFn:'&myAttr' }`, then isolate scope property `localFn` will point to
5243
5244
  * a function wrapper for the `count = count + value` expression. Often it's desirable to
5244
- * pass data from the isolated scope via an expression and to the parent scope, this can be
5245
+ * pass data from the isolated scope via an expression to the parent scope, this can be
5245
5246
  * done by passing a map of local variable names and values into the expression wrapper fn.
5246
5247
  * For example, if the expression is `increment(amount)` then we can specify the amount value
5247
5248
  * by calling the `localFn` as `localFn({amount: 22})`.
@@ -5468,10 +5469,10 @@ function $TemplateCacheProvider() {
5468
5469
  * to illustrate how `$compile` works.
5469
5470
  * </div>
5470
5471
  *
5471
- <example module="compile">
5472
+ <example module="compileExample">
5472
5473
  <file name="index.html">
5473
5474
  <script>
5474
- angular.module('compile', [], function($compileProvider) {
5475
+ angular.module('compileExample', [], function($compileProvider) {
5475
5476
  // configure new 'compile' directive by passing a directive
5476
5477
  // factory function. The factory function injects the '$compile'
5477
5478
  $compileProvider.directive('compile', function($compile) {
@@ -5495,15 +5496,14 @@ function $TemplateCacheProvider() {
5495
5496
  }
5496
5497
  );
5497
5498
  };
5498
- })
5499
- });
5500
-
5501
- function Ctrl($scope) {
5499
+ });
5500
+ })
5501
+ .controller('GreeterController', ['$scope', function($scope) {
5502
5502
  $scope.name = 'Angular';
5503
5503
  $scope.html = 'Hello {{name}}';
5504
- }
5504
+ }]);
5505
5505
  </script>
5506
- <div ng-controller="Ctrl">
5506
+ <div ng-controller="GreeterController">
5507
5507
  <input ng-model="name"> <br>
5508
5508
  <textarea ng-model="html"></textarea> <br>
5509
5509
  <div compile="html"></div>
@@ -7239,18 +7239,19 @@ function $ControllerProvider() {
7239
7239
  * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
7240
7240
  *
7241
7241
  * @example
7242
- <example>
7242
+ <example module="documentExample">
7243
7243
  <file name="index.html">
7244
- <div ng-controller="MainCtrl">
7244
+ <div ng-controller="ExampleController">
7245
7245
  <p>$document title: <b ng-bind="title"></b></p>
7246
7246
  <p>window.document title: <b ng-bind="windowTitle"></b></p>
7247
7247
  </div>
7248
7248
  </file>
7249
7249
  <file name="script.js">
7250
- function MainCtrl($scope, $document) {
7251
- $scope.title = $document[0].title;
7252
- $scope.windowTitle = angular.element(window.document)[0].title;
7253
- }
7250
+ angular.module('documentExample', [])
7251
+ .controller('ExampleController', ['$scope', '$document', function($scope, $document) {
7252
+ $scope.title = $document[0].title;
7253
+ $scope.windowTitle = angular.element(window.document)[0].title;
7254
+ }]);
7254
7255
  </file>
7255
7256
  </example>
7256
7257
  */
@@ -7383,12 +7384,39 @@ function isSuccess(status) {
7383
7384
  }
7384
7385
 
7385
7386
 
7387
+ /**
7388
+ * @ngdoc provider
7389
+ * @name $httpProvider
7390
+ * @description
7391
+ * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
7392
+ * */
7386
7393
  function $HttpProvider() {
7387
7394
  var JSON_START = /^\s*(\[|\{[^\{])/,
7388
7395
  JSON_END = /[\}\]]\s*$/,
7389
7396
  PROTECTION_PREFIX = /^\)\]\}',?\n/,
7390
7397
  CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': 'application/json;charset=utf-8'};
7391
7398
 
7399
+ /**
7400
+ * @ngdoc property
7401
+ * @name $httpProvider#defaults
7402
+ * @description
7403
+ *
7404
+ * Object containing default values for all {@link ng.$http $http} requests.
7405
+ *
7406
+ * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
7407
+ * Defaults value is `'XSRF-TOKEN'`.
7408
+ *
7409
+ * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
7410
+ * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
7411
+ *
7412
+ * - **`defaults.headers`** - {Object} - Default headers for all $http requests.
7413
+ * Refer to {@link ng.$http#setting-http-headers $http} for documentation on
7414
+ * setting default headers.
7415
+ * - **`defaults.headers.common`**
7416
+ * - **`defaults.headers.post`**
7417
+ * - **`defaults.headers.put`**
7418
+ * - **`defaults.headers.patch`**
7419
+ **/
7392
7420
  var defaults = this.defaults = {
7393
7421
  // transform incoming response data
7394
7422
  transformResponse: [function(data) {
@@ -7878,9 +7906,9 @@ function $HttpProvider() {
7878
7906
  *
7879
7907
  *
7880
7908
  * @example
7881
- <example>
7909
+ <example module="httpExample">
7882
7910
  <file name="index.html">
7883
- <div ng-controller="FetchCtrl">
7911
+ <div ng-controller="FetchController">
7884
7912
  <select ng-model="method">
7885
7913
  <option>GET</option>
7886
7914
  <option>JSONP</option>
@@ -7902,30 +7930,32 @@ function $HttpProvider() {
7902
7930
  </div>
7903
7931
  </file>
7904
7932
  <file name="script.js">
7905
- function FetchCtrl($scope, $http, $templateCache) {
7906
- $scope.method = 'GET';
7907
- $scope.url = 'http-hello.html';
7908
-
7909
- $scope.fetch = function() {
7910
- $scope.code = null;
7911
- $scope.response = null;
7912
-
7913
- $http({method: $scope.method, url: $scope.url, cache: $templateCache}).
7914
- success(function(data, status) {
7915
- $scope.status = status;
7916
- $scope.data = data;
7917
- }).
7918
- error(function(data, status) {
7919
- $scope.data = data || "Request failed";
7920
- $scope.status = status;
7921
- });
7922
- };
7933
+ angular.module('httpExample', [])
7934
+ .controller('FetchController', ['$scope', '$http', '$templateCache',
7935
+ function($scope, $http, $templateCache) {
7936
+ $scope.method = 'GET';
7937
+ $scope.url = 'http-hello.html';
7938
+
7939
+ $scope.fetch = function() {
7940
+ $scope.code = null;
7941
+ $scope.response = null;
7942
+
7943
+ $http({method: $scope.method, url: $scope.url, cache: $templateCache}).
7944
+ success(function(data, status) {
7945
+ $scope.status = status;
7946
+ $scope.data = data;
7947
+ }).
7948
+ error(function(data, status) {
7949
+ $scope.data = data || "Request failed";
7950
+ $scope.status = status;
7951
+ });
7952
+ };
7923
7953
 
7924
- $scope.updateModel = function(method, url) {
7925
- $scope.method = method;
7926
- $scope.url = url;
7927
- };
7928
- }
7954
+ $scope.updateModel = function(method, url) {
7955
+ $scope.method = method;
7956
+ $scope.url = url;
7957
+ };
7958
+ }]);
7929
7959
  </file>
7930
7960
  <file name="http-hello.html">
7931
7961
  Hello, $http!
@@ -7979,7 +8009,7 @@ function $HttpProvider() {
7979
8009
  var reqData = transformData(config.data, headersGetter(headers), config.transformRequest);
7980
8010
 
7981
8011
  // strip content-type if data is undefined
7982
- if (isUndefined(config.data)) {
8012
+ if (isUndefined(reqData)) {
7983
8013
  forEach(headers, function(value, header) {
7984
8014
  if (lowercase(header) === 'content-type') {
7985
8015
  delete headers[header];
@@ -8048,10 +8078,6 @@ function $HttpProvider() {
8048
8078
 
8049
8079
  defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);
8050
8080
 
8051
- // execute if header value is function
8052
- execHeaders(defHeaders);
8053
- execHeaders(reqHeaders);
8054
-
8055
8081
  // using for-in instead of forEach to avoid unecessary iteration after header has been found
8056
8082
  defaultHeadersIteration:
8057
8083
  for (defHeaderName in defHeaders) {
@@ -8066,6 +8092,8 @@ function $HttpProvider() {
8066
8092
  reqHeaders[defHeaderName] = defHeaders[defHeaderName];
8067
8093
  }
8068
8094
 
8095
+ // execute if header value is a function for merged headers
8096
+ execHeaders(reqHeaders);
8069
8097
  return reqHeaders;
8070
8098
 
8071
8099
  function execHeaders(headers) {
@@ -8841,25 +8869,27 @@ function $IntervalProvider() {
8841
8869
  * @returns {promise} A promise which will be notified on each iteration.
8842
8870
  *
8843
8871
  * @example
8844
- * <example module="time">
8845
- * <file name="index.html">
8846
- * <script>
8847
- * function Ctrl2($scope,$interval) {
8848
- * $scope.format = 'M/d/yy h:mm:ss a';
8849
- * $scope.blood_1 = 100;
8850
- * $scope.blood_2 = 120;
8872
+ * <example module="intervalExample">
8873
+ * <file name="index.html">
8874
+ * <script>
8875
+ * angular.module('intervalExample', [])
8876
+ * .controller('ExampleController', ['$scope', '$interval',
8877
+ * function($scope, $interval) {
8878
+ * $scope.format = 'M/d/yy h:mm:ss a';
8879
+ * $scope.blood_1 = 100;
8880
+ * $scope.blood_2 = 120;
8851
8881
  *
8852
- * var stop;
8853
- * $scope.fight = function() {
8854
- * // Don't start a new fight if we are already fighting
8855
- * if ( angular.isDefined(stop) ) return;
8882
+ * var stop;
8883
+ * $scope.fight = function() {
8884
+ * // Don't start a new fight if we are already fighting
8885
+ * if ( angular.isDefined(stop) ) return;
8856
8886
  *
8857
8887
  * stop = $interval(function() {
8858
8888
  * if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
8859
- * $scope.blood_1 = $scope.blood_1 - 3;
8860
- * $scope.blood_2 = $scope.blood_2 - 4;
8889
+ * $scope.blood_1 = $scope.blood_1 - 3;
8890
+ * $scope.blood_2 = $scope.blood_2 - 4;
8861
8891
  * } else {
8862
- * $scope.stopFight();
8892
+ * $scope.stopFight();
8863
8893
  * }
8864
8894
  * }, 100);
8865
8895
  * };
@@ -8874,22 +8904,21 @@ function $IntervalProvider() {
8874
8904
  * $scope.resetFight = function() {
8875
8905
  * $scope.blood_1 = 100;
8876
8906
  * $scope.blood_2 = 120;
8877
- * }
8907
+ * };
8878
8908
  *
8879
8909
  * $scope.$on('$destroy', function() {
8880
- * // Make sure that the interval is destroyed too
8910
+ * // Make sure that the interval nis destroyed too
8881
8911
  * $scope.stopFight();
8882
8912
  * });
8883
- * }
8884
- *
8885
- * angular.module('time', [])
8886
- * // Register the 'myCurrentTime' directive factory method.
8887
- * // We inject $interval and dateFilter service since the factory method is DI.
8888
- * .directive('myCurrentTime', function($interval, dateFilter) {
8913
+ * })
8914
+ * // Register the 'myCurrentTime' directive factory method.
8915
+ * // We inject $interval and dateFilter service since the factory method is DI.
8916
+ * .directive('myCurrentTime', ['$interval', 'dateFilter',
8917
+ * function($interval, dateFilter) {
8889
8918
  * // return the directive link function. (compile function not needed)
8890
8919
  * return function(scope, element, attrs) {
8891
8920
  * var format, // date format
8892
- * stopTime; // so that we can cancel the time updates
8921
+ * stopTime; // so that we can cancel the time updates
8893
8922
  *
8894
8923
  * // used to update the UI
8895
8924
  * function updateTime() {
@@ -8905,28 +8934,28 @@ function $IntervalProvider() {
8905
8934
  * stopTime = $interval(updateTime, 1000);
8906
8935
  *
8907
8936
  * // listen on DOM destroy (removal) event, and cancel the next UI update
8908
- * // to prevent updating time ofter the DOM element was removed.
8937
+ * // to prevent updating time after the DOM element was removed.
8909
8938
  * element.bind('$destroy', function() {
8910
8939
  * $interval.cancel(stopTime);
8911
8940
  * });
8912
8941
  * }
8913
8942
  * });
8914
- * </script>
8943
+ * </script>
8915
8944
  *
8916
- * <div>
8917
- * <div ng-controller="Ctrl2">
8918
- * Date format: <input ng-model="format"> <hr/>
8919
- * Current time is: <span my-current-time="format"></span>
8920
- * <hr/>
8921
- * Blood 1 : <font color='red'>{{blood_1}}</font>
8922
- * Blood 2 : <font color='red'>{{blood_2}}</font>
8923
- * <button type="button" data-ng-click="fight()">Fight</button>
8924
- * <button type="button" data-ng-click="stopFight()">StopFight</button>
8925
- * <button type="button" data-ng-click="resetFight()">resetFight</button>
8926
- * </div>
8945
+ * <div>
8946
+ * <div ng-controller="ExampleController">
8947
+ * Date format: <input ng-model="format"> <hr/>
8948
+ * Current time is: <span my-current-time="format"></span>
8949
+ * <hr/>
8950
+ * Blood 1 : <font color='red'>{{blood_1}}</font>
8951
+ * Blood 2 : <font color='red'>{{blood_2}}</font>
8952
+ * <button type="button" data-ng-click="fight()">Fight</button>
8953
+ * <button type="button" data-ng-click="stopFight()">StopFight</button>
8954
+ * <button type="button" data-ng-click="resetFight()">resetFight</button>
8927
8955
  * </div>
8956
+ * </div>
8928
8957
  *
8929
- * </file>
8958
+ * </file>
8930
8959
  * </example>
8931
8960
  */
8932
8961
  function interval(fn, delay, count, invokeApply) {
@@ -9483,14 +9512,17 @@ LocationHashbangInHtml5Url.prototype =
9483
9512
  * If the argument is a hash object containing an array of values, these values will be encoded
9484
9513
  * as duplicate search parameters in the url.
9485
9514
  *
9486
- * @param {(string|Array<string>)=} paramValue If `search` is a string, then `paramValue` will
9487
- * override only a single search property.
9515
+ * @param {(string|Array<string>|boolean)=} paramValue If `search` is a string, then `paramValue`
9516
+ * will override only a single search property.
9488
9517
  *
9489
9518
  * If `paramValue` is an array, it will override the property of the `search` component of
9490
9519
  * `$location` specified via the first argument.
9491
9520
  *
9492
9521
  * If `paramValue` is `null`, the property specified via the first argument will be deleted.
9493
9522
  *
9523
+ * If `paramValue` is `true`, the property specified via the first argument will be added with no
9524
+ * value nor trailing equal sign.
9525
+ *
9494
9526
  * @return {Object} If called with no arguments returns the parsed `search` object. If called with
9495
9527
  * one or more arguments returns `$location` object itself.
9496
9528
  */
@@ -9502,6 +9534,11 @@ LocationHashbangInHtml5Url.prototype =
9502
9534
  if (isString(search)) {
9503
9535
  this.$$search = parseKeyValue(search);
9504
9536
  } else if (isObject(search)) {
9537
+ // remove object undefined or null properties
9538
+ forEach(search, function(value, key) {
9539
+ if (value == null) delete search[key];
9540
+ });
9541
+
9505
9542
  this.$$search = search;
9506
9543
  } else {
9507
9544
  throw $locationMinErr('isrcharg',
@@ -9823,15 +9860,16 @@ function $LocationProvider(){
9823
9860
  * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
9824
9861
  *
9825
9862
  * @example
9826
- <example>
9863
+ <example module="logExample">
9827
9864
  <file name="script.js">
9828
- function LogCtrl($scope, $log) {
9829
- $scope.$log = $log;
9830
- $scope.message = 'Hello World!';
9831
- }
9865
+ angular.module('logExample', [])
9866
+ .controller('LogController', ['$scope', '$log', function($scope, $log) {
9867
+ $scope.$log = $log;
9868
+ $scope.message = 'Hello World!';
9869
+ }]);
9832
9870
  </file>
9833
9871
  <file name="index.html">
9834
- <div ng-controller="LogCtrl">
9872
+ <div ng-controller="LogController">
9835
9873
  <p>Reload this page with open console, enter text and hit the log button...</p>
9836
9874
  Message:
9837
9875
  <input type="text" ng-model="message"/>
@@ -9855,7 +9893,7 @@ function $LogProvider(){
9855
9893
  self = this;
9856
9894
 
9857
9895
  /**
9858
- * @ngdoc property
9896
+ * @ngdoc method
9859
9897
  * @name $logProvider#debugEnabled
9860
9898
  * @description
9861
9899
  * @param {boolean=} flag enable or disable debug level messages
@@ -10954,26 +10992,6 @@ function cspSafeGetterFn(key0, key1, key2, key3, key4, fullExp, options) {
10954
10992
  };
10955
10993
  }
10956
10994
 
10957
- function simpleGetterFn1(key0, fullExp) {
10958
- ensureSafeMemberName(key0, fullExp);
10959
-
10960
- return function simpleGetterFn1(scope, locals) {
10961
- if (scope == null) return undefined;
10962
- return ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];
10963
- };
10964
- }
10965
-
10966
- function simpleGetterFn2(key0, key1, fullExp) {
10967
- ensureSafeMemberName(key0, fullExp);
10968
- ensureSafeMemberName(key1, fullExp);
10969
-
10970
- return function simpleGetterFn2(scope, locals) {
10971
- if (scope == null) return undefined;
10972
- scope = ((locals && locals.hasOwnProperty(key0)) ? locals : scope)[key0];
10973
- return scope == null ? undefined : scope[key1];
10974
- };
10975
- }
10976
-
10977
10995
  function getterFn(path, options, fullExp) {
10978
10996
  // Check whether the cache has this getter already.
10979
10997
  // We can use hasOwnProperty directly on the cache because we ensure,
@@ -10986,13 +11004,8 @@ function getterFn(path, options, fullExp) {
10986
11004
  pathKeysLength = pathKeys.length,
10987
11005
  fn;
10988
11006
 
10989
- // When we have only 1 or 2 tokens, use optimized special case closures.
10990
11007
  // http://jsperf.com/angularjs-parse-getter/6
10991
- if (!options.unwrapPromises && pathKeysLength === 1) {
10992
- fn = simpleGetterFn1(pathKeys[0], fullExp);
10993
- } else if (!options.unwrapPromises && pathKeysLength === 2) {
10994
- fn = simpleGetterFn2(pathKeys[0], pathKeys[1], fullExp);
10995
- } else if (options.csp) {
11008
+ if (options.csp) {
10996
11009
  if (pathKeysLength < 6) {
10997
11010
  fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp,
10998
11011
  options);
@@ -13119,19 +13132,21 @@ function adjustMatchers(matchers) {
13119
13132
  *
13120
13133
  * Here is what a secure configuration for this scenario might look like:
13121
13134
  *
13122
- * <pre class="prettyprint">
13123
- * angular.module('myApp', []).config(function($sceDelegateProvider) {
13124
- * $sceDelegateProvider.resourceUrlWhitelist([
13125
- * // Allow same origin resource loads.
13126
- * 'self',
13127
- * // Allow loading from our assets domain. Notice the difference between * and **.
13128
- * 'http://srv*.assets.example.com/**']);
13129
- *
13130
- * // The blacklist overrides the whitelist so the open redirect here is blocked.
13131
- * $sceDelegateProvider.resourceUrlBlacklist([
13132
- * 'http://myapp.example.com/clickThru**']);
13133
- * });
13134
- * </pre>
13135
+ * ```
13136
+ * angular.module('myApp', []).config(function($sceDelegateProvider) {
13137
+ * $sceDelegateProvider.resourceUrlWhitelist([
13138
+ * // Allow same origin resource loads.
13139
+ * 'self',
13140
+ * // Allow loading from our assets domain. Notice the difference between * and **.
13141
+ * 'http://srv*.assets.example.com/**'
13142
+ * ]);
13143
+ *
13144
+ * // The blacklist overrides the whitelist so the open redirect here is blocked.
13145
+ * $sceDelegateProvider.resourceUrlBlacklist([
13146
+ * 'http://myapp.example.com/clickThru**'
13147
+ * ]);
13148
+ * });
13149
+ * ```
13135
13150
  */
13136
13151
 
13137
13152
  function $SceDelegateProvider() {
@@ -13426,10 +13441,10 @@ function $SceDelegateProvider() {
13426
13441
  *
13427
13442
  * Here's an example of a binding in a privileged context:
13428
13443
  *
13429
- * <pre class="prettyprint">
13430
- * <input ng-model="userHtml">
13431
- * <div ng-bind-html="userHtml">
13432
- * </pre>
13444
+ * ```
13445
+ * <input ng-model="userHtml">
13446
+ * <div ng-bind-html="userHtml"></div>
13447
+ * ```
13433
13448
  *
13434
13449
  * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user. With SCE
13435
13450
  * disabled, this application allows the user to render arbitrary HTML into the DIV.
@@ -13469,15 +13484,15 @@ function $SceDelegateProvider() {
13469
13484
  * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
13470
13485
  * simplified):
13471
13486
  *
13472
- * <pre class="prettyprint">
13473
- * var ngBindHtmlDirective = ['$sce', function($sce) {
13474
- * return function(scope, element, attr) {
13475
- * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
13476
- * element.html(value || '');
13477
- * });
13478
- * };
13479
- * }];
13480
- * </pre>
13487
+ * ```
13488
+ * var ngBindHtmlDirective = ['$sce', function($sce) {
13489
+ * return function(scope, element, attr) {
13490
+ * scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
13491
+ * element.html(value || '');
13492
+ * });
13493
+ * };
13494
+ * }];
13495
+ * ```
13481
13496
  *
13482
13497
  * ## Impact on loading templates
13483
13498
  *
@@ -13581,66 +13596,65 @@ function $SceDelegateProvider() {
13581
13596
  *
13582
13597
  * ## Show me an example using SCE.
13583
13598
  *
13584
- * @example
13585
- <example module="mySceApp" deps="angular-sanitize.js">
13586
- <file name="index.html">
13587
- <div ng-controller="myAppController as myCtrl">
13588
- <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
13589
- <b>User comments</b><br>
13590
- By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when
13591
- $sanitize is available. If $sanitize isn't available, this results in an error instead of an
13592
- exploit.
13593
- <div class="well">
13594
- <div ng-repeat="userComment in myCtrl.userComments">
13595
- <b>{{userComment.name}}</b>:
13596
- <span ng-bind-html="userComment.htmlComment" class="htmlComment"></span>
13597
- <br>
13598
- </div>
13599
- </div>
13600
- </div>
13601
- </file>
13602
-
13603
- <file name="script.js">
13604
- var mySceApp = angular.module('mySceApp', ['ngSanitize']);
13605
-
13606
- mySceApp.controller("myAppController", function myAppController($http, $templateCache, $sce) {
13607
- var self = this;
13608
- $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
13609
- self.userComments = userComments;
13610
- });
13611
- self.explicitlyTrustedHtml = $sce.trustAsHtml(
13612
- '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
13613
- 'sanitization.&quot;">Hover over this text.</span>');
13614
- });
13615
- </file>
13616
-
13617
- <file name="test_data.json">
13618
- [
13619
- { "name": "Alice",
13620
- "htmlComment":
13621
- "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
13622
- },
13623
- { "name": "Bob",
13624
- "htmlComment": "<i>Yes!</i> Am I the only other one?"
13625
- }
13626
- ]
13627
- </file>
13628
-
13629
- <file name="protractor.js" type="protractor">
13630
- describe('SCE doc demo', function() {
13631
- it('should sanitize untrusted values', function() {
13632
- expect(element(by.css('.htmlComment')).getInnerHtml())
13633
- .toBe('<span>Is <i>anyone</i> reading this?</span>');
13634
- });
13635
-
13636
- it('should NOT sanitize explicitly trusted values', function() {
13637
- expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
13638
- '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
13639
- 'sanitization.&quot;">Hover over this text.</span>');
13640
- });
13641
- });
13642
- </file>
13643
- </example>
13599
+ * <example module="mySceApp" deps="angular-sanitize.js">
13600
+ * <file name="index.html">
13601
+ * <div ng-controller="myAppController as myCtrl">
13602
+ * <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
13603
+ * <b>User comments</b><br>
13604
+ * By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when
13605
+ * $sanitize is available. If $sanitize isn't available, this results in an error instead of an
13606
+ * exploit.
13607
+ * <div class="well">
13608
+ * <div ng-repeat="userComment in myCtrl.userComments">
13609
+ * <b>{{userComment.name}}</b>:
13610
+ * <span ng-bind-html="userComment.htmlComment" class="htmlComment"></span>
13611
+ * <br>
13612
+ * </div>
13613
+ * </div>
13614
+ * </div>
13615
+ * </file>
13616
+ *
13617
+ * <file name="script.js">
13618
+ * var mySceApp = angular.module('mySceApp', ['ngSanitize']);
13619
+ *
13620
+ * mySceApp.controller("myAppController", function myAppController($http, $templateCache, $sce) {
13621
+ * var self = this;
13622
+ * $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
13623
+ * self.userComments = userComments;
13624
+ * });
13625
+ * self.explicitlyTrustedHtml = $sce.trustAsHtml(
13626
+ * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
13627
+ * 'sanitization.&quot;">Hover over this text.</span>');
13628
+ * });
13629
+ * </file>
13630
+ *
13631
+ * <file name="test_data.json">
13632
+ * [
13633
+ * { "name": "Alice",
13634
+ * "htmlComment":
13635
+ * "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
13636
+ * },
13637
+ * { "name": "Bob",
13638
+ * "htmlComment": "<i>Yes!</i> Am I the only other one?"
13639
+ * }
13640
+ * ]
13641
+ * </file>
13642
+ *
13643
+ * <file name="protractor.js" type="protractor">
13644
+ * describe('SCE doc demo', function() {
13645
+ * it('should sanitize untrusted values', function() {
13646
+ * expect(element.all(by.css('.htmlComment')).first().getInnerHtml())
13647
+ * .toBe('<span>Is <i>anyone</i> reading this?</span>');
13648
+ * });
13649
+ *
13650
+ * it('should NOT sanitize explicitly trusted values', function() {
13651
+ * expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
13652
+ * '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
13653
+ * 'sanitization.&quot;">Hover over this text.</span>');
13654
+ * });
13655
+ * });
13656
+ * </file>
13657
+ * </example>
13644
13658
  *
13645
13659
  *
13646
13660
  *
@@ -13654,13 +13668,13 @@ function $SceDelegateProvider() {
13654
13668
  *
13655
13669
  * That said, here's how you can completely disable SCE:
13656
13670
  *
13657
- * <pre class="prettyprint">
13658
- * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
13659
- * // Completely disable SCE. For demonstration purposes only!
13660
- * // Do not use in new projects.
13661
- * $sceProvider.enabled(false);
13662
- * });
13663
- * </pre>
13671
+ * ```
13672
+ * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
13673
+ * // Completely disable SCE. For demonstration purposes only!
13674
+ * // Do not use in new projects.
13675
+ * $sceProvider.enabled(false);
13676
+ * });
13677
+ * ```
13664
13678
  *
13665
13679
  */
13666
13680
  /* jshint maxlen: 100 */
@@ -14357,17 +14371,18 @@ function urlIsSameOrigin(requestUrl) {
14357
14371
  * expression.
14358
14372
  *
14359
14373
  * @example
14360
- <example>
14374
+ <example module="windowExample">
14361
14375
  <file name="index.html">
14362
14376
  <script>
14363
- function Ctrl($scope, $window) {
14364
- $scope.greeting = 'Hello, World!';
14365
- $scope.doGreeting = function(greeting) {
14377
+ angular.module('windowExample', [])
14378
+ .controller('ExampleController', ['$scope', '$window', function ($scope, $window) {
14379
+ $scope.greeting = 'Hello, World!';
14380
+ $scope.doGreeting = function(greeting) {
14366
14381
  $window.alert(greeting);
14367
- };
14368
- }
14382
+ };
14383
+ }]);
14369
14384
  </script>
14370
- <div ng-controller="Ctrl">
14385
+ <div ng-controller="ExampleController">
14371
14386
  <input type="text" ng-model="greeting" />
14372
14387
  <button ng-click="doGreeting(greeting)">ALERT</button>
14373
14388
  </div>
@@ -14766,14 +14781,15 @@ function filterFilter() {
14766
14781
  *
14767
14782
  *
14768
14783
  * @example
14769
- <example>
14784
+ <example module="currencyExample">
14770
14785
  <file name="index.html">
14771
14786
  <script>
14772
- function Ctrl($scope) {
14773
- $scope.amount = 1234.56;
14774
- }
14787
+ angular.module('currencyExample', [])
14788
+ .controller('ExampleController', ['$scope', function($scope) {
14789
+ $scope.amount = 1234.56;
14790
+ }]);
14775
14791
  </script>
14776
- <div ng-controller="Ctrl">
14792
+ <div ng-controller="ExampleController">
14777
14793
  <input type="number" ng-model="amount"> <br>
14778
14794
  default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
14779
14795
  custom currency identifier (USD$): <span>{{amount | currency:"USD$"}}</span>
@@ -14825,14 +14841,15 @@ function currencyFilter($locale) {
14825
14841
  * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit.
14826
14842
  *
14827
14843
  * @example
14828
- <example>
14844
+ <example module="numberFilterExample">
14829
14845
  <file name="index.html">
14830
14846
  <script>
14831
- function Ctrl($scope) {
14832
- $scope.val = 1234.56789;
14833
- }
14847
+ angular.module('numberFilterExample', [])
14848
+ .controller('ExampleController', ['$scope', function($scope) {
14849
+ $scope.val = 1234.56789;
14850
+ }]);
14834
14851
  </script>
14835
- <div ng-controller="Ctrl">
14852
+ <div ng-controller="ExampleController">
14836
14853
  Enter number: <input ng-model='val'><br>
14837
14854
  Default formatting: <span id='number-default'>{{val | number}}</span><br>
14838
14855
  No fractions: <span>{{val | number:0}}</span><br>
@@ -15256,17 +15273,18 @@ var uppercaseFilter = valueFn(uppercase);
15256
15273
  * had less than `limit` elements.
15257
15274
  *
15258
15275
  * @example
15259
- <example>
15276
+ <example module="limitToExample">
15260
15277
  <file name="index.html">
15261
15278
  <script>
15262
- function Ctrl($scope) {
15263
- $scope.numbers = [1,2,3,4,5,6,7,8,9];
15264
- $scope.letters = "abcdefghi";
15265
- $scope.numLimit = 3;
15266
- $scope.letterLimit = 3;
15267
- }
15279
+ angular.module('limitToExample', [])
15280
+ .controller('ExampleController', ['$scope', function($scope) {
15281
+ $scope.numbers = [1,2,3,4,5,6,7,8,9];
15282
+ $scope.letters = "abcdefghi";
15283
+ $scope.numLimit = 3;
15284
+ $scope.letterLimit = 3;
15285
+ }]);
15268
15286
  </script>
15269
- <div ng-controller="Ctrl">
15287
+ <div ng-controller="ExampleController">
15270
15288
  Limit {{numbers}} to: <input type="integer" ng-model="numLimit">
15271
15289
  <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
15272
15290
  Limit {{letters}} to: <input type="integer" ng-model="letterLimit">
@@ -15378,20 +15396,21 @@ function limitToFilter(){
15378
15396
  * @returns {Array} Sorted copy of the source array.
15379
15397
  *
15380
15398
  * @example
15381
- <example>
15399
+ <example module="orderByExample">
15382
15400
  <file name="index.html">
15383
15401
  <script>
15384
- function Ctrl($scope) {
15385
- $scope.friends =
15386
- [{name:'John', phone:'555-1212', age:10},
15387
- {name:'Mary', phone:'555-9876', age:19},
15388
- {name:'Mike', phone:'555-4321', age:21},
15389
- {name:'Adam', phone:'555-5678', age:35},
15390
- {name:'Julie', phone:'555-8765', age:29}]
15391
- $scope.predicate = '-age';
15392
- }
15402
+ angular.module('orderByExample', [])
15403
+ .controller('ExampleController', ['$scope', function($scope) {
15404
+ $scope.friends =
15405
+ [{name:'John', phone:'555-1212', age:10},
15406
+ {name:'Mary', phone:'555-9876', age:19},
15407
+ {name:'Mike', phone:'555-4321', age:21},
15408
+ {name:'Adam', phone:'555-5678', age:35},
15409
+ {name:'Julie', phone:'555-8765', age:29}];
15410
+ $scope.predicate = '-age';
15411
+ }]);
15393
15412
  </script>
15394
- <div ng-controller="Ctrl">
15413
+ <div ng-controller="ExampleController">
15395
15414
  <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>
15396
15415
  <hr/>
15397
15416
  [ <a href="" ng-click="predicate=''">unsorted</a> ]
@@ -15419,7 +15438,7 @@ function limitToFilter(){
15419
15438
  * Example:
15420
15439
  *
15421
15440
  * @example
15422
- <example>
15441
+ <example module="orderByExample">
15423
15442
  <file name="index.html">
15424
15443
  <div ng-controller="Ctrl">
15425
15444
  <table class="friend">
@@ -15439,21 +15458,21 @@ function limitToFilter(){
15439
15458
  </file>
15440
15459
 
15441
15460
  <file name="script.js">
15442
- function Ctrl($scope, $filter) {
15443
- var orderBy = $filter('orderBy');
15444
- $scope.friends = [
15445
- { name: 'John', phone: '555-1212', age: 10 },
15446
- { name: 'Mary', phone: '555-9876', age: 19 },
15447
- { name: 'Mike', phone: '555-4321', age: 21 },
15448
- { name: 'Adam', phone: '555-5678', age: 35 },
15449
- { name: 'Julie', phone: '555-8765', age: 29 }
15450
- ];
15451
-
15452
- $scope.order = function(predicate, reverse) {
15453
- $scope.friends = orderBy($scope.friends, predicate, reverse);
15454
- };
15455
- $scope.order('-age',false);
15456
- }
15461
+ angular.module('orderByExample', [])
15462
+ .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {
15463
+ var orderBy = $filter('orderBy');
15464
+ $scope.friends = [
15465
+ { name: 'John', phone: '555-1212', age: 10 },
15466
+ { name: 'Mary', phone: '555-9876', age: 19 },
15467
+ { name: 'Mike', phone: '555-4321', age: 21 },
15468
+ { name: 'Adam', phone: '555-5678', age: 35 },
15469
+ { name: 'Julie', phone: '555-8765', age: 29 }
15470
+ ];
15471
+ $scope.order = function(predicate, reverse) {
15472
+ $scope.friends = orderBy($scope.friends, predicate, reverse);
15473
+ };
15474
+ $scope.order('-age',false);
15475
+ }]);
15457
15476
  </file>
15458
15477
  </example>
15459
15478
  */
@@ -15639,7 +15658,7 @@ var htmlAnchorDirective = valueFn({
15639
15658
  return browser.driver.getCurrentUrl().then(function(url) {
15640
15659
  return url.match(/\/123$/);
15641
15660
  });
15642
- }, 1000, 'page should navigate to /123');
15661
+ }, 5000, 'page should navigate to /123');
15643
15662
  });
15644
15663
 
15645
15664
  xit('should execute ng-click but not reload when href empty string and name specified', function() {
@@ -15667,7 +15686,7 @@ var htmlAnchorDirective = valueFn({
15667
15686
  return browser.driver.getCurrentUrl().then(function(url) {
15668
15687
  return url.match(/\/6$/);
15669
15688
  });
15670
- }, 1000, 'page should navigate to /6');
15689
+ }, 5000, 'page should navigate to /6');
15671
15690
  });
15672
15691
  </file>
15673
15692
  </example>
@@ -16283,12 +16302,13 @@ function FormController(element, attrs, $scope, $animate) {
16283
16302
  * </pre>
16284
16303
  *
16285
16304
  * @example
16286
- <example deps="angular-animate.js" animations="true" fixBase="true">
16305
+ <example deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
16287
16306
  <file name="index.html">
16288
16307
  <script>
16289
- function Ctrl($scope) {
16290
- $scope.userType = 'guest';
16291
- }
16308
+ angular.module('formExample', [])
16309
+ .controller('FormController', ['$scope', function($scope) {
16310
+ $scope.userType = 'guest';
16311
+ }]);
16292
16312
  </script>
16293
16313
  <style>
16294
16314
  .my-form {
@@ -16300,7 +16320,7 @@ function FormController(element, attrs, $scope, $animate) {
16300
16320
  background: red;
16301
16321
  }
16302
16322
  </style>
16303
- <form name="myForm" ng-controller="Ctrl" class="my-form">
16323
+ <form name="myForm" ng-controller="FormController" class="my-form">
16304
16324
  userType: <input name="input" ng-model="userType" required>
16305
16325
  <span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
16306
16326
  <tt>userType = {{userType}}</tt><br>
@@ -16403,7 +16423,7 @@ var ngFormDirective = formDirectiveFactory(true);
16403
16423
  */
16404
16424
 
16405
16425
  var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
16406
- var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i;
16426
+ var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
16407
16427
  var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
16408
16428
 
16409
16429
  var inputType = {
@@ -16433,15 +16453,16 @@ var inputType = {
16433
16453
  * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
16434
16454
  *
16435
16455
  * @example
16436
- <example name="text-input-directive">
16456
+ <example name="text-input-directive" module="textInputExample">
16437
16457
  <file name="index.html">
16438
16458
  <script>
16439
- function Ctrl($scope) {
16440
- $scope.text = 'guest';
16441
- $scope.word = /^\s*\w*\s*$/;
16442
- }
16459
+ angular.module('textInputExample', [])
16460
+ .controller('ExampleController', ['$scope', function($scope) {
16461
+ $scope.text = 'guest';
16462
+ $scope.word = /^\s*\w*\s*$/;
16463
+ }]);
16443
16464
  </script>
16444
- <form name="myForm" ng-controller="Ctrl">
16465
+ <form name="myForm" ng-controller="ExampleController">
16445
16466
  Single word: <input type="text" name="input" ng-model="text"
16446
16467
  ng-pattern="word" required ng-trim="false">
16447
16468
  <span class="error" ng-show="myForm.input.$error.required">
@@ -16513,14 +16534,15 @@ var inputType = {
16513
16534
  * interaction with the input element.
16514
16535
  *
16515
16536
  * @example
16516
- <example name="number-input-directive">
16537
+ <example name="number-input-directive" module="numberExample">
16517
16538
  <file name="index.html">
16518
16539
  <script>
16519
- function Ctrl($scope) {
16520
- $scope.value = 12;
16521
- }
16540
+ angular.module('numberExample', [])
16541
+ .controller('ExampleController', ['$scope', function($scope) {
16542
+ $scope.value = 12;
16543
+ }]);
16522
16544
  </script>
16523
- <form name="myForm" ng-controller="Ctrl">
16545
+ <form name="myForm" ng-controller="ExampleController">
16524
16546
  Number: <input type="number" name="input" ng-model="value"
16525
16547
  min="0" max="99" required>
16526
16548
  <span class="error" ng-show="myForm.input.$error.required">
@@ -16588,14 +16610,15 @@ var inputType = {
16588
16610
  * interaction with the input element.
16589
16611
  *
16590
16612
  * @example
16591
- <example name="url-input-directive">
16613
+ <example name="url-input-directive" module="urlExample">
16592
16614
  <file name="index.html">
16593
16615
  <script>
16594
- function Ctrl($scope) {
16595
- $scope.text = 'http://google.com';
16596
- }
16616
+ angular.module('urlExample', [])
16617
+ .controller('ExampleController', ['$scope', function($scope) {
16618
+ $scope.text = 'http://google.com';
16619
+ }]);
16597
16620
  </script>
16598
- <form name="myForm" ng-controller="Ctrl">
16621
+ <form name="myForm" ng-controller="ExampleController">
16599
16622
  URL: <input type="url" name="input" ng-model="text" required>
16600
16623
  <span class="error" ng-show="myForm.input.$error.required">
16601
16624
  Required!</span>
@@ -16664,14 +16687,15 @@ var inputType = {
16664
16687
  * interaction with the input element.
16665
16688
  *
16666
16689
  * @example
16667
- <example name="email-input-directive">
16690
+ <example name="email-input-directive" module="emailExample">
16668
16691
  <file name="index.html">
16669
16692
  <script>
16670
- function Ctrl($scope) {
16671
- $scope.text = 'me@example.com';
16672
- }
16693
+ angular.module('emailExample', [])
16694
+ .controller('ExampleController', ['$scope', function($scope) {
16695
+ $scope.text = 'me@example.com';
16696
+ }]);
16673
16697
  </script>
16674
- <form name="myForm" ng-controller="Ctrl">
16698
+ <form name="myForm" ng-controller="ExampleController">
16675
16699
  Email: <input type="email" name="input" ng-model="text" required>
16676
16700
  <span class="error" ng-show="myForm.input.$error.required">
16677
16701
  Required!</span>
@@ -16730,18 +16754,19 @@ var inputType = {
16730
16754
  * be set when selected.
16731
16755
  *
16732
16756
  * @example
16733
- <example name="radio-input-directive">
16757
+ <example name="radio-input-directive" module="radioExample">
16734
16758
  <file name="index.html">
16735
16759
  <script>
16736
- function Ctrl($scope) {
16737
- $scope.color = 'blue';
16738
- $scope.specialValue = {
16739
- "id": "12345",
16740
- "value": "green"
16741
- };
16742
- }
16760
+ angular.module('radioExample', [])
16761
+ .controller('ExampleController', ['$scope', function($scope) {
16762
+ $scope.color = 'blue';
16763
+ $scope.specialValue = {
16764
+ "id": "12345",
16765
+ "value": "green"
16766
+ };
16767
+ }]);
16743
16768
  </script>
16744
- <form name="myForm" ng-controller="Ctrl">
16769
+ <form name="myForm" ng-controller="ExampleController">
16745
16770
  <input type="radio" ng-model="color" value="red"> Red <br/>
16746
16771
  <input type="radio" ng-model="color" ng-value="specialValue"> Green <br/>
16747
16772
  <input type="radio" ng-model="color" value="blue"> Blue <br/>
@@ -16780,15 +16805,16 @@ var inputType = {
16780
16805
  * interaction with the input element.
16781
16806
  *
16782
16807
  * @example
16783
- <example name="checkbox-input-directive">
16808
+ <example name="checkbox-input-directive" module="checkboxExample">
16784
16809
  <file name="index.html">
16785
16810
  <script>
16786
- function Ctrl($scope) {
16787
- $scope.value1 = true;
16788
- $scope.value2 = 'YES'
16789
- }
16811
+ angular.module('checkboxExample', [])
16812
+ .controller('ExampleController', ['$scope', function($scope) {
16813
+ $scope.value1 = true;
16814
+ $scope.value2 = 'YES'
16815
+ }]);
16790
16816
  </script>
16791
- <form name="myForm" ng-controller="Ctrl">
16817
+ <form name="myForm" ng-controller="ExampleController">
16792
16818
  Value1: <input type="checkbox" ng-model="value1"> <br/>
16793
16819
  Value2: <input type="checkbox" ng-model="value2"
16794
16820
  ng-true-value="YES" ng-false-value="NO"> <br/>
@@ -17188,14 +17214,15 @@ function checkboxInputType(scope, element, attr, ctrl) {
17188
17214
  * interaction with the input element.
17189
17215
  *
17190
17216
  * @example
17191
- <example name="input-directive">
17217
+ <example name="input-directive" module="inputExample">
17192
17218
  <file name="index.html">
17193
17219
  <script>
17194
- function Ctrl($scope) {
17195
- $scope.user = {name: 'guest', last: 'visitor'};
17196
- }
17220
+ angular.module('inputExample', [])
17221
+ .controller('ExampleController', ['$scope', function($scope) {
17222
+ $scope.user = {name: 'guest', last: 'visitor'};
17223
+ }]);
17197
17224
  </script>
17198
- <div ng-controller="Ctrl">
17225
+ <div ng-controller="ExampleController">
17199
17226
  <form name="myForm">
17200
17227
  User name: <input type="text" name="userName" ng-model="user.name" required>
17201
17228
  <span class="error" ng-show="myForm.userName.$error.required">
@@ -17713,12 +17740,13 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
17713
17740
  * </pre>
17714
17741
  *
17715
17742
  * @example
17716
- * <example deps="angular-animate.js" animations="true" fixBase="true">
17743
+ * <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample">
17717
17744
  <file name="index.html">
17718
17745
  <script>
17719
- function Ctrl($scope) {
17720
- $scope.val = '1';
17721
- }
17746
+ angular.module('inputExample', [])
17747
+ .controller('ExampleController', ['$scope', function($scope) {
17748
+ $scope.val = '1';
17749
+ }]);
17722
17750
  </script>
17723
17751
  <style>
17724
17752
  .my-input {
@@ -17733,7 +17761,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
17733
17761
  </style>
17734
17762
  Update input to see transitions when valid/invalid.
17735
17763
  Integer is a valid value.
17736
- <form name="testForm" ng-controller="Ctrl">
17764
+ <form name="testForm" ng-controller="ExampleController">
17737
17765
  <input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input" />
17738
17766
  </form>
17739
17767
  </file>
@@ -17777,17 +17805,18 @@ var ngModelDirective = function() {
17777
17805
  * in input value.
17778
17806
  *
17779
17807
  * @example
17780
- * <example name="ngChange-directive">
17808
+ * <example name="ngChange-directive" module="changeExample">
17781
17809
  * <file name="index.html">
17782
17810
  * <script>
17783
- * function Controller($scope) {
17784
- * $scope.counter = 0;
17785
- * $scope.change = function() {
17786
- * $scope.counter++;
17787
- * };
17788
- * }
17811
+ * angular.module('changeExample', [])
17812
+ * .controller('ExampleController', ['$scope', function($scope) {
17813
+ * $scope.counter = 0;
17814
+ * $scope.change = function() {
17815
+ * $scope.counter++;
17816
+ * };
17817
+ * }]);
17789
17818
  * </script>
17790
- * <div ng-controller="Controller">
17819
+ * <div ng-controller="ExampleController">
17791
17820
  * <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
17792
17821
  * <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
17793
17822
  * <label for="ng-change-example2">Confirmed</label><br />
@@ -17868,14 +17897,15 @@ var requiredDirective = function() {
17868
17897
  * specified in form `/something/` then the value will be converted into a regular expression.
17869
17898
  *
17870
17899
  * @example
17871
- <example name="ngList-directive">
17900
+ <example name="ngList-directive" module="listExample">
17872
17901
  <file name="index.html">
17873
17902
  <script>
17874
- function Ctrl($scope) {
17875
- $scope.names = ['igor', 'misko', 'vojta'];
17876
- }
17903
+ angular.module('listExample', [])
17904
+ .controller('ExampleController', ['$scope', function($scope) {
17905
+ $scope.names = ['igor', 'misko', 'vojta'];
17906
+ }]);
17877
17907
  </script>
17878
- <form name="myForm" ng-controller="Ctrl">
17908
+ <form name="myForm" ng-controller="ExampleController">
17879
17909
  List: <input name="namesInput" ng-model="names" ng-list required>
17880
17910
  <span class="error" ng-show="myForm.namesInput.$error.required">
17881
17911
  Required!</span>
@@ -17967,15 +17997,16 @@ var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
17967
17997
  * of the `input` element
17968
17998
  *
17969
17999
  * @example
17970
- <example name="ngValue-directive">
18000
+ <example name="ngValue-directive" module="valueExample">
17971
18001
  <file name="index.html">
17972
18002
  <script>
17973
- function Ctrl($scope) {
17974
- $scope.names = ['pizza', 'unicorns', 'robots'];
17975
- $scope.my = { favorite: 'unicorns' };
17976
- }
18003
+ angular.module('valueExample', [])
18004
+ .controller('ExampleController', ['$scope', function($scope) {
18005
+ $scope.names = ['pizza', 'unicorns', 'robots'];
18006
+ $scope.my = { favorite: 'unicorns' };
18007
+ }]);
17977
18008
  </script>
17978
- <form ng-controller="Ctrl">
18009
+ <form ng-controller="ExampleController">
17979
18010
  <h2>Which is your favorite?</h2>
17980
18011
  <label ng-repeat="name in names" for="{{name}}">
17981
18012
  {{name}}
@@ -18046,14 +18077,15 @@ var ngValueDirective = function() {
18046
18077
  *
18047
18078
  * @example
18048
18079
  * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
18049
- <example>
18080
+ <example module="bindExample">
18050
18081
  <file name="index.html">
18051
18082
  <script>
18052
- function Ctrl($scope) {
18053
- $scope.name = 'Whirled';
18054
- }
18083
+ angular.module('bindExample', [])
18084
+ .controller('ExampleController', ['$scope', function($scope) {
18085
+ $scope.name = 'Whirled';
18086
+ }]);
18055
18087
  </script>
18056
- <div ng-controller="Ctrl">
18088
+ <div ng-controller="ExampleController">
18057
18089
  Enter name: <input type="text" ng-model="name"><br>
18058
18090
  Hello <span ng-bind="name"></span>!
18059
18091
  </div>
@@ -18104,15 +18136,16 @@ var ngBindDirective = ngDirective({
18104
18136
  *
18105
18137
  * @example
18106
18138
  * Try it here: enter text in text box and watch the greeting change.
18107
- <example>
18139
+ <example module="bindExample">
18108
18140
  <file name="index.html">
18109
18141
  <script>
18110
- function Ctrl($scope) {
18111
- $scope.salutation = 'Hello';
18112
- $scope.name = 'World';
18113
- }
18142
+ angular.module('bindExample', [])
18143
+ .controller('ExampleController', ['$scope', function ($scope) {
18144
+ $scope.salutation = 'Hello';
18145
+ $scope.name = 'World';
18146
+ }]);
18114
18147
  </script>
18115
- <div ng-controller="Ctrl">
18148
+ <div ng-controller="ExampleController">
18116
18149
  Salutation: <input type="text" ng-model="salutation"><br>
18117
18150
  Name: <input type="text" ng-model="name"><br>
18118
18151
  <pre ng-bind-template="{{salutation}} {{name}}!"></pre>
@@ -18170,20 +18203,20 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
18170
18203
  * @example
18171
18204
  Try it here: enter text in text box and watch the greeting change.
18172
18205
 
18173
- <example module="ngBindHtmlExample" deps="angular-sanitize.js">
18206
+ <example module="bindHtmlExample" deps="angular-sanitize.js">
18174
18207
  <file name="index.html">
18175
- <div ng-controller="ngBindHtmlCtrl">
18208
+ <div ng-controller="ExampleController">
18176
18209
  <p ng-bind-html="myHTML"></p>
18177
18210
  </div>
18178
18211
  </file>
18179
18212
 
18180
18213
  <file name="script.js">
18181
- angular.module('ngBindHtmlExample', ['ngSanitize'])
18182
-
18183
- .controller('ngBindHtmlCtrl', ['$scope', function ngBindHtmlCtrl($scope) {
18184
- $scope.myHTML =
18185
- 'I am an <code>HTML</code>string with <a href="#">links!</a> and other <em>stuff</em>';
18186
- }]);
18214
+ angular.module('bindHtmlExample', ['ngSanitize'])
18215
+ .controller('ExampleController', ['$scope', function($scope) {
18216
+ $scope.myHTML =
18217
+ 'I am an <code>HTML</code>string with ' +
18218
+ '<a href="#">links!</a> and other <em>stuff</em>';
18219
+ }]);
18187
18220
  </file>
18188
18221
 
18189
18222
  <file name="protractor.js" type="protractor">
@@ -18682,7 +18715,7 @@ var ngCloakDirective = ngDirective({
18682
18715
  *
18683
18716
  * This example demonstrates the `controller as` syntax.
18684
18717
  *
18685
- * <example name="ngControllerAs">
18718
+ * <example name="ngControllerAs" module="controllerAsExample">
18686
18719
  * <file name="index.html">
18687
18720
  * <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
18688
18721
  * Name: <input type="text" ng-model="settings.name"/>
@@ -18703,6 +18736,9 @@ var ngCloakDirective = ngDirective({
18703
18736
  * </div>
18704
18737
  * </file>
18705
18738
  * <file name="app.js">
18739
+ * angular.module('controllerAsExample', [])
18740
+ * .controller('SettingsController1', SettingsController1);
18741
+ *
18706
18742
  * function SettingsController1() {
18707
18743
  * this.name = "John Smith";
18708
18744
  * this.contacts = [
@@ -18731,29 +18767,29 @@ var ngCloakDirective = ngDirective({
18731
18767
  * <file name="protractor.js" type="protractor">
18732
18768
  * it('should check controller as', function() {
18733
18769
  * var container = element(by.id('ctrl-as-exmpl'));
18734
- * expect(container.findElement(by.model('settings.name'))
18770
+ * expect(container.element(by.model('settings.name'))
18735
18771
  * .getAttribute('value')).toBe('John Smith');
18736
18772
  *
18737
18773
  * var firstRepeat =
18738
- * container.findElement(by.repeater('contact in settings.contacts').row(0));
18774
+ * container.element(by.repeater('contact in settings.contacts').row(0));
18739
18775
  * var secondRepeat =
18740
- * container.findElement(by.repeater('contact in settings.contacts').row(1));
18776
+ * container.element(by.repeater('contact in settings.contacts').row(1));
18741
18777
  *
18742
- * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
18778
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
18743
18779
  * .toBe('408 555 1212');
18744
18780
  *
18745
- * expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))
18781
+ * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
18746
18782
  * .toBe('john.smith@example.org');
18747
18783
  *
18748
- * firstRepeat.findElement(by.linkText('clear')).click();
18784
+ * firstRepeat.element(by.linkText('clear')).click();
18749
18785
  *
18750
- * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
18786
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
18751
18787
  * .toBe('');
18752
18788
  *
18753
- * container.findElement(by.linkText('add')).click();
18789
+ * container.element(by.linkText('add')).click();
18754
18790
  *
18755
- * expect(container.findElement(by.repeater('contact in settings.contacts').row(2))
18756
- * .findElement(by.model('contact.value'))
18791
+ * expect(container.element(by.repeater('contact in settings.contacts').row(2))
18792
+ * .element(by.model('contact.value'))
18757
18793
  * .getAttribute('value'))
18758
18794
  * .toBe('yourname@example.org');
18759
18795
  * });
@@ -18762,7 +18798,7 @@ var ngCloakDirective = ngDirective({
18762
18798
  *
18763
18799
  * This example demonstrates the "attach to `$scope`" style of controller.
18764
18800
  *
18765
- * <example name="ngController">
18801
+ * <example name="ngController" module="controllerExample">
18766
18802
  * <file name="index.html">
18767
18803
  * <div id="ctrl-exmpl" ng-controller="SettingsController2">
18768
18804
  * Name: <input type="text" ng-model="name"/>
@@ -18783,6 +18819,9 @@ var ngCloakDirective = ngDirective({
18783
18819
  * </div>
18784
18820
  * </file>
18785
18821
  * <file name="app.js">
18822
+ * angular.module('controllerExample', [])
18823
+ * .controller('SettingsController2', ['$scope', SettingsController2]);
18824
+ *
18786
18825
  * function SettingsController2($scope) {
18787
18826
  * $scope.name = "John Smith";
18788
18827
  * $scope.contacts = [
@@ -18812,28 +18851,28 @@ var ngCloakDirective = ngDirective({
18812
18851
  * it('should check controller', function() {
18813
18852
  * var container = element(by.id('ctrl-exmpl'));
18814
18853
  *
18815
- * expect(container.findElement(by.model('name'))
18854
+ * expect(container.element(by.model('name'))
18816
18855
  * .getAttribute('value')).toBe('John Smith');
18817
18856
  *
18818
18857
  * var firstRepeat =
18819
- * container.findElement(by.repeater('contact in contacts').row(0));
18858
+ * container.element(by.repeater('contact in contacts').row(0));
18820
18859
  * var secondRepeat =
18821
- * container.findElement(by.repeater('contact in contacts').row(1));
18860
+ * container.element(by.repeater('contact in contacts').row(1));
18822
18861
  *
18823
- * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
18862
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
18824
18863
  * .toBe('408 555 1212');
18825
- * expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))
18864
+ * expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
18826
18865
  * .toBe('john.smith@example.org');
18827
18866
  *
18828
- * firstRepeat.findElement(by.linkText('clear')).click();
18867
+ * firstRepeat.element(by.linkText('clear')).click();
18829
18868
  *
18830
- * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
18869
+ * expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
18831
18870
  * .toBe('');
18832
18871
  *
18833
- * container.findElement(by.linkText('add')).click();
18872
+ * container.element(by.linkText('add')).click();
18834
18873
  *
18835
- * expect(container.findElement(by.repeater('contact in contacts').row(2))
18836
- * .findElement(by.model('contact.value'))
18874
+ * expect(container.element(by.repeater('contact in contacts').row(2))
18875
+ * .element(by.model('contact.value'))
18837
18876
  * .getAttribute('value'))
18838
18877
  * .toBe('yourname@example.org');
18839
18878
  * });
@@ -19204,21 +19243,22 @@ forEach(
19204
19243
  * ({@link guide/expression#-event- Event object is available as `$event`})
19205
19244
  *
19206
19245
  * @example
19207
- <example>
19246
+ <example module="submitExample">
19208
19247
  <file name="index.html">
19209
19248
  <script>
19210
- function Ctrl($scope) {
19211
- $scope.list = [];
19212
- $scope.text = 'hello';
19213
- $scope.submit = function() {
19214
- if ($scope.text) {
19215
- $scope.list.push(this.text);
19216
- $scope.text = '';
19217
- }
19218
- };
19219
- }
19249
+ angular.module('submitExample', [])
19250
+ .controller('ExampleController', ['$scope', function($scope) {
19251
+ $scope.list = [];
19252
+ $scope.text = 'hello';
19253
+ $scope.submit = function() {
19254
+ if ($scope.text) {
19255
+ $scope.list.push(this.text);
19256
+ $scope.text = '';
19257
+ }
19258
+ };
19259
+ }]);
19220
19260
  </script>
19221
- <form ng-submit="submit()" ng-controller="Ctrl">
19261
+ <form ng-submit="submit()" ng-controller="ExampleController">
19222
19262
  Enter text and hit enter:
19223
19263
  <input type="text" ng-model="text" name="text" />
19224
19264
  <input type="submit" id="submit" value="Submit" />
@@ -19230,7 +19270,7 @@ forEach(
19230
19270
  expect(element(by.binding('list')).getText()).toBe('list=[]');
19231
19271
  element(by.css('#submit')).click();
19232
19272
  expect(element(by.binding('list')).getText()).toContain('hello');
19233
- expect(element(by.input('text')).getAttribute('value')).toBe('');
19273
+ expect(element(by.model('text')).getAttribute('value')).toBe('');
19234
19274
  });
19235
19275
  it('should ignore empty strings', function() {
19236
19276
  expect(element(by.binding('list')).getText()).toBe('list=[]');
@@ -19503,9 +19543,9 @@ var ngIfDirective = ['$animate', function($animate) {
19503
19543
  * - Otherwise enable scrolling only if the expression evaluates to truthy value.
19504
19544
  *
19505
19545
  * @example
19506
- <example module="ngAnimate" deps="angular-animate.js" animations="true">
19546
+ <example module="includeExample" deps="angular-animate.js" animations="true">
19507
19547
  <file name="index.html">
19508
- <div ng-controller="Ctrl">
19548
+ <div ng-controller="ExampleController">
19509
19549
  <select ng-model="template" ng-options="t.name for t in templates">
19510
19550
  <option value="">(blank)</option>
19511
19551
  </select>
@@ -19517,12 +19557,13 @@ var ngIfDirective = ['$animate', function($animate) {
19517
19557
  </div>
19518
19558
  </file>
19519
19559
  <file name="script.js">
19520
- function Ctrl($scope) {
19521
- $scope.templates =
19522
- [ { name: 'template1.html', url: 'template1.html'},
19523
- { name: 'template2.html', url: 'template2.html'} ];
19524
- $scope.template = $scope.templates[0];
19525
- }
19560
+ angular.module('includeExample', ['ngAnimate'])
19561
+ .controller('ExampleController', ['$scope', function($scope) {
19562
+ $scope.templates =
19563
+ [ { name: 'template1.html', url: 'template1.html'},
19564
+ { name: 'template2.html', url: 'template2.html'} ];
19565
+ $scope.template = $scope.templates[0];
19566
+ }]);
19526
19567
  </file>
19527
19568
  <file name="template1.html">
19528
19569
  Content of template1.html
@@ -19585,7 +19626,7 @@ var ngIfDirective = ['$animate', function($animate) {
19585
19626
  return;
19586
19627
  }
19587
19628
  templateSelect.click();
19588
- templateSelect.element.all(by.css('option')).get(2).click();
19629
+ templateSelect.all(by.css('option')).get(2).click();
19589
19630
  expect(includeElem.getText()).toMatch(/Content of template2.html/);
19590
19631
  });
19591
19632
 
@@ -19595,7 +19636,7 @@ var ngIfDirective = ['$animate', function($animate) {
19595
19636
  return;
19596
19637
  }
19597
19638
  templateSelect.click();
19598
- templateSelect.element.all(by.css('option')).get(0).click();
19639
+ templateSelect.all(by.css('option')).get(0).click();
19599
19640
  expect(includeElem.isPresent()).toBe(false);
19600
19641
  });
19601
19642
  </file>
@@ -19747,14 +19788,15 @@ var ngIncludeFillContentDirective = ['$compile',
19747
19788
  * @param {expression} ngInit {@link guide/expression Expression} to eval.
19748
19789
  *
19749
19790
  * @example
19750
- <example>
19791
+ <example module="initExample">
19751
19792
  <file name="index.html">
19752
19793
  <script>
19753
- function Ctrl($scope) {
19754
- $scope.list = [['a', 'b'], ['c', 'd']];
19755
- }
19794
+ angular.module('initExample', [])
19795
+ .controller('ExampleController', ['$scope', function($scope) {
19796
+ $scope.list = [['a', 'b'], ['c', 'd']];
19797
+ }]);
19756
19798
  </script>
19757
- <div ng-controller="Ctrl">
19799
+ <div ng-controller="ExampleController">
19758
19800
  <div ng-repeat="innerList in list" ng-init="outerIndex = $index">
19759
19801
  <div ng-repeat="value in innerList" ng-init="innerIndex = $index">
19760
19802
  <span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
@@ -19907,16 +19949,17 @@ var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
19907
19949
  * @param {number=} offset Offset to deduct from the total number.
19908
19950
  *
19909
19951
  * @example
19910
- <example>
19952
+ <example module="pluralizeExample">
19911
19953
  <file name="index.html">
19912
19954
  <script>
19913
- function Ctrl($scope) {
19914
- $scope.person1 = 'Igor';
19915
- $scope.person2 = 'Misko';
19916
- $scope.personCount = 1;
19917
- }
19955
+ angular.module('pluralizeExample', [])
19956
+ .controller('ExampleController', ['$scope', function($scope) {
19957
+ $scope.person1 = 'Igor';
19958
+ $scope.person2 = 'Misko';
19959
+ $scope.personCount = 1;
19960
+ }]);
19918
19961
  </script>
19919
- <div ng-controller="Ctrl">
19962
+ <div ng-controller="ExampleController">
19920
19963
  Person 1:<input type="text" ng-model="person1" value="Igor" /><br/>
19921
19964
  Person 2:<input type="text" ng-model="person2" value="Misko" /><br/>
19922
19965
  Number of People:<input type="text" ng-model="personCount" value="1" /><br/>
@@ -20850,9 +20893,9 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
20850
20893
  *
20851
20894
  *
20852
20895
  * @example
20853
- <example module="ngAnimate" deps="angular-animate.js" animations="true">
20896
+ <example module="switchExample" deps="angular-animate.js" animations="true">
20854
20897
  <file name="index.html">
20855
- <div ng-controller="Ctrl">
20898
+ <div ng-controller="ExampleController">
20856
20899
  <select ng-model="selection" ng-options="item for item in items">
20857
20900
  </select>
20858
20901
  <tt>selection={{selection}}</tt>
@@ -20866,10 +20909,11 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
20866
20909
  </div>
20867
20910
  </file>
20868
20911
  <file name="script.js">
20869
- function Ctrl($scope) {
20870
- $scope.items = ['settings', 'home', 'other'];
20871
- $scope.selection = $scope.items[0];
20872
- }
20912
+ angular.module('switchExample', ['ngAnimate'])
20913
+ .controller('ExampleController', ['$scope', function($scope) {
20914
+ $scope.items = ['settings', 'home', 'other'];
20915
+ $scope.selection = $scope.items[0];
20916
+ }]);
20873
20917
  </file>
20874
20918
  <file name="animations.css">
20875
20919
  .animate-switch-container {
@@ -20912,11 +20956,11 @@ var ngStyleDirective = ngDirective(function(scope, element, attr) {
20912
20956
  expect(switchElem.getText()).toMatch(/Settings Div/);
20913
20957
  });
20914
20958
  it('should change to home', function() {
20915
- select.element.all(by.css('option')).get(1).click();
20959
+ select.all(by.css('option')).get(1).click();
20916
20960
  expect(switchElem.getText()).toMatch(/Home Span/);
20917
20961
  });
20918
20962
  it('should select default', function() {
20919
- select.element.all(by.css('option')).get(2).click();
20963
+ select.all(by.css('option')).get(2).click();
20920
20964
  expect(switchElem.getText()).toMatch(/default/);
20921
20965
  });
20922
20966
  </file>
@@ -21008,15 +21052,10 @@ var ngSwitchDefaultDirective = ngDirective({
21008
21052
  * @element ANY
21009
21053
  *
21010
21054
  * @example
21011
- <example module="transclude">
21055
+ <example module="transcludeExample">
21012
21056
  <file name="index.html">
21013
21057
  <script>
21014
- function Ctrl($scope) {
21015
- $scope.title = 'Lorem Ipsum';
21016
- $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
21017
- }
21018
-
21019
- angular.module('transclude', [])
21058
+ angular.module('transcludeExample', [])
21020
21059
  .directive('pane', function(){
21021
21060
  return {
21022
21061
  restrict: 'E',
@@ -21027,9 +21066,13 @@ var ngSwitchDefaultDirective = ngDirective({
21027
21066
  '<div ng-transclude></div>' +
21028
21067
  '</div>'
21029
21068
  };
21030
- });
21069
+ })
21070
+ .controller('ExampleController', ['$scope', function($scope) {
21071
+ $scope.title = 'Lorem Ipsum';
21072
+ $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
21073
+ }]);
21031
21074
  </script>
21032
- <div ng-controller="Ctrl">
21075
+ <div ng-controller="ExampleController">
21033
21076
  <input ng-model="title"><br>
21034
21077
  <textarea ng-model="text"></textarea> <br/>
21035
21078
  <pane title="{{title}}">{{text}}</pane>
@@ -21188,21 +21231,22 @@ var ngOptionsMinErr = minErr('ngOptions');
21188
21231
  * `value` variable (e.g. `value.propertyName`).
21189
21232
  *
21190
21233
  * @example
21191
- <example>
21234
+ <example module="selectExample">
21192
21235
  <file name="index.html">
21193
21236
  <script>
21194
- function MyCntrl($scope) {
21195
- $scope.colors = [
21196
- {name:'black', shade:'dark'},
21197
- {name:'white', shade:'light'},
21198
- {name:'red', shade:'dark'},
21199
- {name:'blue', shade:'dark'},
21200
- {name:'yellow', shade:'light'}
21201
- ];
21202
- $scope.myColor = $scope.colors[2]; // red
21203
- }
21237
+ angular.module('selectExample', [])
21238
+ .controller('ExampleController', ['$scope', function($scope) {
21239
+ $scope.colors = [
21240
+ {name:'black', shade:'dark'},
21241
+ {name:'white', shade:'light'},
21242
+ {name:'red', shade:'dark'},
21243
+ {name:'blue', shade:'dark'},
21244
+ {name:'yellow', shade:'light'}
21245
+ ];
21246
+ $scope.myColor = $scope.colors[2]; // red
21247
+ }]);
21204
21248
  </script>
21205
- <div ng-controller="MyCntrl">
21249
+ <div ng-controller="ExampleController">
21206
21250
  <ul>
21207
21251
  <li ng-repeat="color in colors">
21208
21252
  Name: <input ng-model="color.name">
@@ -21239,7 +21283,7 @@ var ngOptionsMinErr = minErr('ngOptions');
21239
21283
  <file name="protractor.js" type="protractor">
21240
21284
  it('should check ng-options', function() {
21241
21285
  expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');
21242
- element.all(by.select('myColor')).first().click();
21286
+ element.all(by.model('myColor')).first().click();
21243
21287
  element.all(by.css('select[ng-model="myColor"] option')).first().click();
21244
21288
  expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
21245
21289
  element(by.css('.nullable select[ng-model="myColor"]')).click();