Skip to content

ArrayIndices Documentation #959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2018
Merged
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
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ the surface it uses `ng-if` so the hidden field is *not* part of the form.
`condition` should be a string with an angular expression. If that expression evaluates as thruthy
the field will be rendered into the DOM otherwise not. The expression is evaluated in the parent scope of
the `sf-schema` directive (the same as onClick on buttons) but with access to the current model,
current model value and current array index under the name `model`, `modelValue` and `arrayIndex`.
current model value and current array index under the name `model`, `modelValue` and `arrayIndex`/`arrayIndices`.
This is useful for hiding/showing parts of a form depending on another form control.

ex. A checkbox that shows an input field for a code when checked
Expand Down Expand Up @@ -869,15 +869,15 @@ function FormCtrl($scope) {
"persons[].eligible",
{
key: "persons[].code",
condition: "persons[arrayIndex].eligible", //or "model[arrayIndex].eligable"
condition: "persons[arrayIndex].eligible", //or "model[arrayIndex].eligible"
}
]
}
]
}
```

Note that arrays inside arrays won't work with conditions.
Arrays-in-arrays must use `arrayIndices`. e.g. `model[arrayIndices[0]].child[arrayIndices[1]].etc`.


### destroyStrategy
Expand Down