File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
docs/content/error/compile Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change
1
+ @ngdoc error
2
+ @name $compile:enscp
3
+ @fullName Can not export controller as no scope object is provided
4
+ @description
5
+ If the directive doesn't have a local scope or is not a valid object, you can not export
6
+ the controller. Please specify the scope element the defining the directive, even if its
7
+ empty.
8
+
9
+ <pre>
10
+ myModule.directive('directiveName', function factory() {
11
+ return {
12
+ ...
13
+ controllerAs: 'DirCtrl'; // ERROR: no local scope specified
14
+ ...
15
+ }
16
+ });
17
+ </pre>
18
+
19
+ <pre>
20
+ myModule.directive('directiveName', function factory() {
21
+ return {
22
+ ...
23
+ scope: {},
24
+ controllerAs: 'DirCtrl'; // OK: local scope is a valid object
25
+ ...
26
+ }
27
+ });
28
+ </pre>
Original file line number Diff line number Diff line change @@ -1036,8 +1036,8 @@ function $CompileProvider($provide) {
1036
1036
controllerInstance ) ;
1037
1037
if ( directive . controllerAs ) {
1038
1038
if ( typeof locals . $scope !== 'object' ) {
1039
- throw new Error ( ' Can not export controller as "' + identifier + '". ' +
1040
- 'No scope object provided!' ) ;
1039
+ throw $compileMinErr ( 'enscp' , " Can not export controller as '{0}' as no scope object is provided!'" ,
1040
+ identifier ) ;
1041
1041
}
1042
1042
1043
1043
locals . $scope [ directive . controllerAs ] = controllerInstance ;
You can’t perform that action at this time.
0 commit comments