aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/error/$injector
diff options
context:
space:
mode:
authorPeter Bacon Darwin2014-02-16 22:02:31 +0000
committerPeter Bacon Darwin2014-02-16 22:02:41 +0000
commit33e1bdc543bcb7875dcc004d487333393670ed2d (patch)
tree7ff1f564ab486f049b7e9e5ad946a6a88bb651b6 /docs/content/error/$injector
parent49f90e559ed412402ad7444bc2db2bc1c182ddf5 (diff)
downloadangular.js-33e1bdc543bcb7875dcc004d487333393670ed2d.tar.bz2
chore(errors): rename folders to match namespaces
Diffstat (limited to 'docs/content/error/$injector')
-rw-r--r--docs/content/error/$injector/cdep.ngdoc26
-rw-r--r--docs/content/error/$injector/itkn.ngdoc26
-rw-r--r--docs/content/error/$injector/modulerr.ngdoc11
-rw-r--r--docs/content/error/$injector/nomod.ngdoc26
-rw-r--r--docs/content/error/$injector/pget.ngdoc26
-rw-r--r--docs/content/error/$injector/unpr.ngdoc26
6 files changed, 141 insertions, 0 deletions
diff --git a/docs/content/error/$injector/cdep.ngdoc b/docs/content/error/$injector/cdep.ngdoc
new file mode 100644
index 00000000..0e6526b8
--- /dev/null
+++ b/docs/content/error/$injector/cdep.ngdoc
@@ -0,0 +1,26 @@
+@ngdoc error
+@name $injector:cdep
+@fullName Circular Dependency
+@description
+
+This error occurs when the {@link 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
new file mode 100644
index 00000000..5437dce7
--- /dev/null
+++ b/docs/content/error/$injector/itkn.ngdoc
@@ -0,0 +1,26 @@
+@ngdoc error
+@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
new file mode 100644
index 00000000..4b92a5de
--- /dev/null
+++ b/docs/content/error/$injector/modulerr.ngdoc
@@ -0,0 +1,11 @@
+@ngdoc error
+@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.
+
+In AngularJS `1.2.0` and later, `ngRoute` has been moved to its own module.
+If you are getting this error after upgrading to `1.2.x`, be sure that you've
+installed {@link ngRoute `ngRoute`}.
diff --git a/docs/content/error/$injector/nomod.ngdoc b/docs/content/error/$injector/nomod.ngdoc
new file mode 100644
index 00000000..5f8fb1e6
--- /dev/null
+++ b/docs/content/error/$injector/nomod.ngdoc
@@ -0,0 +1,26 @@
+@ngdoc error
+@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 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
new file mode 100644
index 00000000..1772d348
--- /dev/null
+++ b/docs/content/error/$injector/pget.ngdoc
@@ -0,0 +1,26 @@
+@ngdoc error
+@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 auto.$provide#methods_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
new file mode 100644
index 00000000..1b0faa8e
--- /dev/null
+++ b/docs/content/error/$injector/unpr.ngdoc
@@ -0,0 +1,26 @@
+@ngdoc error
+@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