HotDrink / hotdrink

JavaScript MVVM library with support for multi-way dependencies and generic, rich UI behaviors.
http://hotdrink.github.io/hotdrink/
58 stars 9 forks source link

enable/disable binders #35

Closed philipvr closed 11 years ago

philipvr commented 12 years ago

I added enable/disable binders so that you can do this:

var Model = hd.model(function Model() {
  this.itemToAdd = hd.variable("");
  // ...
}
var model = new Model;

$(document).ready(function () {
  hd.bind(model);
});
<form data-bind="submit: addItem">
  New item:
  <input data-bind='btb: itemToAdd' />
  <button type="submit" data-bind="enable: itemToAdd">Add</button>
</form>