Skip to content

added Array Extension Methods to the API page #267

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 2 commits into from
Mar 30, 2016
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
34 changes: 34 additions & 0 deletions src/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2161,3 +2161,37 @@ type: api
})
</script>
{% endraw %}

## Array Extension Methods

### array.$set(index, value)

- **Arguments**
- `{Number} index`
- `{*} value`

- **Usage**

Set an element in the array to a value by index and trigger view updates.

``` js
vm.animals.$set(0, { name: 'Aardvark' })
```

- **See also:** [Mutation Methods](/guide/list.html#Mutation-Methods)

### array.$remove(reference)

- **Arguments**
- `{Reference} reference`

- **Usage**

Remove an element from an array by reference and trigger view updates.

``` js
var aardvark = vm.animals[0]
vm.animals.$remove(aardvark)
```

- **See also:** [Mutation Methods](/guide/list.html#Mutation-Methods)