mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
docs(errors/$injector/nomod): add info about forgetting to load the module file
Closes #3752
This commit is contained in:
@@ -3,24 +3,31 @@
|
||||
@fullName Module Unavailable
|
||||
@description
|
||||
|
||||
This error occurs when trying to "re-open" a module that has not yet been defined.
|
||||
This error occurs when you declare a dependency on a module that isn't defined anywhere or hasn't
|
||||
been loaded in the current browser context.
|
||||
|
||||
When you receive this error, check that the name of the module in question is correct and that the
|
||||
file in which this module is defined has been loaded (either via `<script>` tag, loader like
|
||||
require.js, or testing harness like karma).
|
||||
|
||||
A less common reason for this error is 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:
|
||||
|
||||
```
|
||||
```js
|
||||
// When defining a module with no module dependencies,
|
||||
// the requires array should be defined and empty.
|
||||
// the array of dependencies 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.
|
||||
`angular.module` without the array argument.
|
||||
|
||||
```
|
||||
```js
|
||||
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.
|
||||
Calling `angular.module` without the array of dependencies 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.
|
||||
|
||||
Reference in New Issue
Block a user