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

Commit b2ae35c

Browse files
Kent C. Doddspetebacondarwin
Kent C. Dodds
authored andcommitted
docs(error/nonassign): add optional binding example
Closes #11701
1 parent 64d0518 commit b2ae35c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

docs/content/error/$compile/nonassign.ngdoc

+17-1
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,25 @@ Following are invalid uses of this directive:
3636
```
3737

3838

39-
To resolve this error, always use path expressions with scope properties that are two-way data-bound:
39+
To resolve this error, do one of the following options:
40+
41+
- use path expressions with scope properties that are two-way data-bound like so:
42+
4043
```
4144
<my-directive bind="some.property">
4245
<my-directive bind="some[3]['property']">
4346
```
4447

48+
- Make the binding optional
49+
50+
```
51+
myModule.directive('myDirective', function factory() {
52+
return {
53+
...
54+
scope: {
55+
localValue: '=?bind' // <-- the '?' makes it optional
56+
}
57+
...
58+
}
59+
});
60+
```

0 commit comments

Comments
 (0)