Skip to content

Commit

Permalink
Added full example to readme (it works on my machine(tm))
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranayub committed Mar 13, 2012
1 parent d53e793 commit 647edba
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions readme.md
Expand Up @@ -41,6 +41,32 @@ vm.arr.without_(2);
// Without this, you would need to do:
vm.arr(vm.arr.without(2));
```
#### Full Example ####

```html
<script type="text/javascript">
var vm = {
peeps: ko.observableArray([{name: "Kamran"}, {name: "John"}])
};
vm.peepsAlt = ko.computed(function () {
return this.peeps.union([{ name: "Sam" }, { name: "Steve" }]);
}, vm);
$(function() {
ko.applyBindings(vm);
});
</script>

<ul data-bind="foreach: peeps">
<li data-bind="text: name"></li>
</ul>

<ul data-bind="foreach: peepsAlt">
<li data-bind="text: name"></li>
</ul>
```

See the [Underscore.js](http://documentcloud.github.com/underscore/) documentation for more information on the API.

See `spec.js` for examples of how to use specific functions, but I'm telling you, it's as you'd expect.
Expand Down

0 comments on commit 647edba

Please sign in to comment.