Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 416e251

Browse files
committed
add error docs
1 parent 3e6172e commit 416e251

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

docs/content/error/ngRef/noctrl.ngdoc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@ngdoc error
2+
@name ngRef:noctrl
3+
@fullName A controller for the value of `ngRefRead` could not be found on the element.
4+
@description
5+
6+
This error occurs when the {@link ng.ngRef ngRef directive} specifies
7+
a value in `ngRefRead` that cannot be resolved to a directive / component controller.
8+
9+
Causes for this error can be:
10+
11+
1. Your `ngRefRead` value has a typo.
12+
2. You have a typo in the *registered* directive / component name.
13+
3. The directive / component does not have a controller.
14+
15+
Note that `ngRefRead` takes the name of the component / directive, not the name of controller, and
16+
also not the combination of directive and 'Controller'. For example, for a directive called 'myDirective',
17+
the correct declaration is `<div ng-ref="$ctrl.ref" ng-ref-read="myDirective">`.
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@ngdoc error
2+
@name ngRef:nonassign
3+
@fullName Non-Assignable Expression
4+
@description
5+
6+
This error occurs when ngRef defines an expression that is not-assignable.
7+
8+
In order for ngRef to work, it must be possible to write the reference into the path defined with the expression.
9+
10+
For example, the following expressions are non-assignable:
11+
12+
```
13+
<my-directive ng-ref="{}"></my-directive>
14+
15+
<my-directive ng-ref="myFn()"></my-directive>
16+
17+
<!-- missing attribute value is also invalid -->
18+
<my-directive ng-ref></my-directive>
19+
20+
```
21+
22+
To resolve this error, use a path expression that are assignable:
23+
24+
```
25+
<my-directive ng-ref="$ctrl.reference"></my-directive>
26+
27+
```

0 commit comments

Comments
 (0)