mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-04 22:49:48 +08:00
Fix the "correct" example to have the proper syntax for creating the locals object and provide a more explicit explanation as to how the scope object should be provided.
22 lines
674 B
Plaintext
22 lines
674 B
Plaintext
@ngdoc error
|
|
@name $controller:noscp
|
|
@fullName Missing $scope object
|
|
@description
|
|
|
|
This error occurs when {@link ng.$controller $controller} service is called in order to instantiate a new controller but no scope is provided via `$scope` property of the locals map.
|
|
|
|
Example of incorrect usage that leads to this error:
|
|
```
|
|
$controller(MyController);
|
|
//or
|
|
$controller(MyController, {scope: newScope});
|
|
```
|
|
|
|
To fix the example above please provide a scope (using the `$scope` property in the locals object) to the $controller call:
|
|
|
|
```
|
|
$controller(MyController, {$scope: newScope});
|
|
```
|
|
|
|
Please consult the {@link ng.$controller $controller} service api docs to learn more.
|