diff options
| -rw-r--r-- | docs/content/error/httpBackend/noxhr.ngdoc | 5 | ||||
| -rw-r--r-- | docs/content/error/injector/cdep.ngdoc | 22 | ||||
| -rw-r--r-- | docs/content/error/injector/itkn.ngdoc | 22 | ||||
| -rw-r--r-- | docs/content/error/injector/modulerr.ngdoc | 3 | ||||
| -rw-r--r-- | docs/content/error/injector/nomod.ngdoc | 22 | ||||
| -rw-r--r-- | docs/content/error/injector/pget.ngdoc | 22 | ||||
| -rw-r--r-- | docs/content/error/injector/unpr.ngdoc | 22 | ||||
| -rw-r--r-- | docs/content/error/interpolate/interr.ngdoc | 3 | ||||
| -rw-r--r-- | docs/content/error/interpolate/noconcat.ngdoc | 8 | ||||
| -rw-r--r-- | docs/content/error/jqLite/off_args.ngdoc | 3 | ||||
| -rw-r--r-- | docs/content/error/jqLite/on_args.ngdoc | 4 | ||||
| -rw-r--r-- | docs/content/error/ng/areq.ngdoc | 4 | ||||
| -rw-r--r-- | docs/content/error/ng/cpi.ngdoc | 6 | ||||
| -rw-r--r-- | docs/content/error/ng/cpws.ngdoc | 6 | ||||
| -rw-r--r-- | docs/content/error/ngModel/noass.ngdoc | 4 | ||||
| -rw-r--r-- | docs/content/error/ngModel/nonassign.ngdoc | 27 | ||||
| -rw-r--r-- | src/ng/directive/input.js | 2 | ||||
| -rw-r--r-- | test/ng/directive/inputSpec.js | 2 | 
18 files changed, 181 insertions, 6 deletions
| diff --git a/docs/content/error/httpBackend/noxhr.ngdoc b/docs/content/error/httpBackend/noxhr.ngdoc index a311620f..3ac5244c 100644 --- a/docs/content/error/httpBackend/noxhr.ngdoc +++ b/docs/content/error/httpBackend/noxhr.ngdoc @@ -2,3 +2,8 @@  @name $httpBackend:noxhr  @fullName Unsupported XHR  @description + +This error occurs in browsers that do not support XmlHttpRequest. AngularJS +supports Safari, Chrome, Firefox, Opera, IE8 and higher, and mobile browsers +(Android, Chrome Mobile, iOS Safari). To avoid this error, use an officially +supported browser.
\ No newline at end of file diff --git a/docs/content/error/injector/cdep.ngdoc b/docs/content/error/injector/cdep.ngdoc index f4a9c909..0e9769c4 100644 --- a/docs/content/error/injector/cdep.ngdoc +++ b/docs/content/error/injector/cdep.ngdoc @@ -2,3 +2,25 @@  @name $injector:cdep  @fullName Circular Dependency  @description + +This error occurs when the {@link api/angular.injector $injector} tries to get +a service that depends on itself, either directly or indirectly. To fix this, +construct your dependency chain such that there are no circular dependencies. + +For example: + +``` +angular.module('myApp', []) +  .factory('myService', function (myService) { +    // ... +  }) +  .controller('MyCtrl', function ($scope, myService) { +    // ... +  }); +``` + +When an instance of `MyCtrl` is created, the service `myService` will be created +by the `$injector`. `myService` depends on itself, which causes the `$injector` +to detect a circular dependency and throw the error. + +For more information, see the {@link guide/di Dependency Injection Guide}.
\ No newline at end of file diff --git a/docs/content/error/injector/itkn.ngdoc b/docs/content/error/injector/itkn.ngdoc index fab64696..5437dce7 100644 --- a/docs/content/error/injector/itkn.ngdoc +++ b/docs/content/error/injector/itkn.ngdoc @@ -2,3 +2,25 @@  @name $injector:itkn  @fullName Bad Injection Token  @description + +This error occurs when using a bad token as a dependency injection annotation. +Dependency injection annotation tokens should always be strings. Using any other +type will cause this error to be thrown. + +Examples of code with bad injection tokens include: + +``` +var myCtrl = function ($scope, $http) { /* ... */ }; +myCtrl.$inject = ['$scope', 42]; + +myAppModule.controller('MyCtrl', ['$scope', {}, function ($scope, $timeout) { +  // ... +}]); +``` + +The bad injection tokens are `42` in the first example and `{}` in the second. +To avoid the error, always use string literals for dependency injection annotation +tokens. + +For an explanation of what injection annotations are and how to use them, refer +to the {@link guide/di Dependency Injection Guide}.
\ No newline at end of file diff --git a/docs/content/error/injector/modulerr.ngdoc b/docs/content/error/injector/modulerr.ngdoc index 5d2aa8f8..e9d77c18 100644 --- a/docs/content/error/injector/modulerr.ngdoc +++ b/docs/content/error/injector/modulerr.ngdoc @@ -2,3 +2,6 @@  @name $injector:modulerr  @fullName Module Error  @description + +This error occurs when a module fails to load due to some exception. The error +message above should provide additional context. diff --git a/docs/content/error/injector/nomod.ngdoc b/docs/content/error/injector/nomod.ngdoc index 6dd4c169..66e2a5ad 100644 --- a/docs/content/error/injector/nomod.ngdoc +++ b/docs/content/error/injector/nomod.ngdoc @@ -2,3 +2,25 @@  @name $injector:nomod  @fullName Module Unavailable  @description + +This error occurs when trying to "re-open" a module that has not yet been defined. + +To define a new module, call {@link api/angular.module angular.module} with a name +and an array of dependent modules, like so: + +``` +// When defining a module with no module dependencies, +// the requires array should be defined and empty. +var myApp = angular.module('myApp', []); +``` + +To retrieve a reference to the same module for further configuration, call +`angular.module` without the `requires` array. + +``` +var myApp = angular.module('myApp'); +``` + +Calling `angular.module` without the `requires` array when the module has not yet +been defined causes this error to be thrown. To fix it, define your module with +a name and an empty array, as in the first example above.
\ No newline at end of file diff --git a/docs/content/error/injector/pget.ngdoc b/docs/content/error/injector/pget.ngdoc index 3eca8d80..e296b8ae 100644 --- a/docs/content/error/injector/pget.ngdoc +++ b/docs/content/error/injector/pget.ngdoc @@ -2,3 +2,25 @@  @name $injector:pget  @fullName Provider Missing $get  @description + +This error occurs when attempting to register a provider that does not have a +`$get` method. For example: + +``` +function BadProvider() {} // No $get method! +angular.module("myApp", []) +  .provider('bad', BadProvider);  // this throws the error +``` + +To fix the error, fill in the `$get` method on the provider like so: + +``` +function GoodProvider() { +  this.$get = angular.noop; +} +angular.module("myApp", []) +  .provider('good', GoodProvider); +``` + +For more information, refer to the {@link api/AUTO.$provide#provider +$provide.provider} api doc.
\ No newline at end of file diff --git a/docs/content/error/injector/unpr.ngdoc b/docs/content/error/injector/unpr.ngdoc index 5459711f..1b0faa8e 100644 --- a/docs/content/error/injector/unpr.ngdoc +++ b/docs/content/error/injector/unpr.ngdoc @@ -2,3 +2,25 @@  @name $injector:unpr  @fullName Unknown Provider  @description + +This error results from the `$injector` being unable to resolve a required +dependency. To fix this, make sure the dependency is defined and spelled +correctly. For example: + +``` +angular.module('myApp', []) +  .controller('myCtrl', ['myService', function (myService) { +    // Do something with myService +  }]); +``` + +This code will fail with `$injector:unpr` if `myService` is not defined. Making +sure each dependency is defined will fix the problem. + +``` +angular.module('myApp', []) +  .service('myService', function () { /* ... */ }) +  .controller('myCtrl', ['myService', function (myService) { +    // Do something with myService +  }]); +```
\ No newline at end of file diff --git a/docs/content/error/interpolate/interr.ngdoc b/docs/content/error/interpolate/interr.ngdoc index a36a1d7d..8d56c8d0 100644 --- a/docs/content/error/interpolate/interr.ngdoc +++ b/docs/content/error/interpolate/interr.ngdoc @@ -2,3 +2,6 @@  @name $interpolate:interr  @fullName Interpolation Error  @description + +This error occurs when interpolation fails due to some exception. The error +message above should provide additional context. diff --git a/docs/content/error/interpolate/noconcat.ngdoc b/docs/content/error/interpolate/noconcat.ngdoc index f1fd6c46..c611b81a 100644 --- a/docs/content/error/interpolate/noconcat.ngdoc +++ b/docs/content/error/interpolate/noconcat.ngdoc @@ -2,3 +2,11 @@  @name $interpolate:noconcat  @fullName Multiple Expressions  @description + +This error occurs when performing an interpolation that concatenates multiple +expressions when a trusted value is required. Concatenating expressions makes +it hard to reason about whether some combination of concatenated values are +unsafe to use and could easily lead to XSS. + +For more information about how AngularJS helps keep your app secure, refer to +the {@link api/ng.$sce $sce} API doc.
\ No newline at end of file diff --git a/docs/content/error/jqLite/off_args.ngdoc b/docs/content/error/jqLite/off_args.ngdoc index 88a981e3..04147242 100644 --- a/docs/content/error/jqLite/off_args.ngdoc +++ b/docs/content/error/jqLite/off_args.ngdoc @@ -2,3 +2,6 @@  @name jqLite:off_args  @fullName Invalid jqLite#off() parameter  @description + +This error occurs when trying to pass too many arguments to `jqLite#off`. Note +that `jqLite#off` does not support namespaces or selectors like jQuery.
\ No newline at end of file diff --git a/docs/content/error/jqLite/on_args.ngdoc b/docs/content/error/jqLite/on_args.ngdoc index 974f20a8..cba1e530 100644 --- a/docs/content/error/jqLite/on_args.ngdoc +++ b/docs/content/error/jqLite/on_args.ngdoc @@ -2,3 +2,7 @@  @name jqLite:on_args  @fullName Invalid jqLite#on() Parameters  @description + +This error occurs when trying to pass too many arguments to `jqLite#on`. Note +that `jqLite#on` does not support the `selector` or `eventData` parameters as +jQuery does. diff --git a/docs/content/error/ng/areq.ngdoc b/docs/content/error/ng/areq.ngdoc index ade8a5ba..fbc45d8a 100644 --- a/docs/content/error/ng/areq.ngdoc +++ b/docs/content/error/ng/areq.ngdoc @@ -2,3 +2,7 @@  @name ng:areq  @fullName Bad Argument  @description + +AngularJS often asserts that certain values will be present and truthy using a +helper function. If the assertion fails, this error is thrown. To fix this problem, +make sure that the value the assertion expects is defined and truthy.
\ No newline at end of file diff --git a/docs/content/error/ng/cpi.ngdoc b/docs/content/error/ng/cpi.ngdoc index 95b30024..5d41ee64 100644 --- a/docs/content/error/ng/cpi.ngdoc +++ b/docs/content/error/ng/cpi.ngdoc @@ -2,3 +2,9 @@  @name ng:cpi  @fullName Bad Copy  @description + +This error occurs when attempting to copy an object to itself. Calling {@link +api/angular.copy angular.copy} with a `destination` object deletes +all of the elements or properties on `destination` before copying to it. Copying +an object to itself is not supported. Make sure to check your calls to +`angular.copy` and avoid copying objects or arrays to themselves.
\ No newline at end of file diff --git a/docs/content/error/ng/cpws.ngdoc b/docs/content/error/ng/cpws.ngdoc index 2f7a9c5b..59b9ffac 100644 --- a/docs/content/error/ng/cpws.ngdoc +++ b/docs/content/error/ng/cpws.ngdoc @@ -2,3 +2,9 @@  @name ng:cpws  @fullName Copying Window or Scope  @description + +Copying Window or Scope instances is not supported because of cyclical and self +references. Avoid copying windows and scopes, as well as any other cyclical or +self-referential structures. Note that trying to deep copy an object containing +cyclical references that is neither a window nor a scope will cause infinite +recursion and a stack overflow.
\ No newline at end of file diff --git a/docs/content/error/ngModel/noass.ngdoc b/docs/content/error/ngModel/noass.ngdoc deleted file mode 100644 index c9fe6637..00000000 --- a/docs/content/error/ngModel/noass.ngdoc +++ /dev/null @@ -1,4 +0,0 @@ -@ngdoc error -@name ngModel:noass -@fullName Non-Assignable Expression -@description diff --git a/docs/content/error/ngModel/nonassign.ngdoc b/docs/content/error/ngModel/nonassign.ngdoc new file mode 100644 index 00000000..33894c49 --- /dev/null +++ b/docs/content/error/ngModel/nonassign.ngdoc @@ -0,0 +1,27 @@ +@ngdoc error +@name ngModel:nonassign +@fullName Non-Assignable Expression +@description + +This error occurs when expression the {@link api/ng.directive:ngModel ngModel} directive is bound to is a non-assignable expression. + +Examples using assignable expressions include: + +``` +<input ng-model="namedVariable"> +<input ng-model="myObj.someProperty"> +<input ng-model="indexedArray[0]"> +``` + +Examples of non-assignable expressions include: + +``` +<input ng-model="foo + bar"> +<input ng-model="42"> +<input ng-model="'oops'"> +<input ng-model="myFunc()"> +``` + +Always make sure that the expression bound via `ngModel` directive can be assigned to. + +For more information, see the {@link api/ng.directive:ngModel ngModel API doc}. diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index f5d30a3e..a07d4fb9 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -940,7 +940,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$        ngModelSet = ngModelGet.assign;    if (!ngModelSet) { -    throw minErr('ngModel')('noass', "Expression '{0}' is non-assignable. Element: {1}", +    throw minErr('ngModel')('nonassign', "Expression '{0}' is non-assignable. Element: {1}",          $attr.ngModel, startingTag($element));    } diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index 8f18964e..a69a4195 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -43,7 +43,7 @@ describe('NgModelController', function() {      }      expect(exception.message). -        toMatch(/^\[ngModel:noass\] Expression '1\+2' is non\-assignable\. Element: <input( value="")? ng-model="1\+2">$/); +        toMatch(/^\[ngModel:nonassign\] Expression '1\+2' is non\-assignable\. Element: <input( value="")? ng-model="1\+2">$/);    })); | 
