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

docs(error/nonassign): add optional binding example #11701

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion docs/content/error/$compile/nonassign.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,25 @@ Following are invalid uses of this directive:
```


To resolve this error, always use path expressions with scope properties that are two-way data-bound:
To resolve this error, do one of the following options:

- use path expressions with scope properties that are two-way data-bound like so:

```
<my-directive bind="some.property">
<my-directive bind="some[3]['property']">
```

- Make the binding optional

```
myModule.directive('myDirective', function factory() {
return {
...
scope: {
localValue: '=?bind' // <-- the '?' makes it optional
}
...
}
});
```