attr-bind
2-way dom element binding
example
Name:Hello !
var bind = ;var elems = document;for var i = 0; i < elemslength; i++ ;
or you can use attractor:
var bind = ;var attr = binder: bind ;attr;
Now the contents of the span tag update as you edit the input box.
If you want to capture the updated values programmatically, you can pass in an observable in place of an element:
var watch = ;;;
methods
var binder =
var bind = binder()
Return a bind()
function. Optionally you can pass in an
observable()-style
function watcher fn
.
bind.call(ctx, elem, key)
Bind the element or observable elem
to
the key at key
.
Look at ctx.scope
for scope information. If there isn't already an entry set
for ctx.scope[key]
, create a new scope entry with
observ.
- To update a observable, do:
ctx.scope[key].set(newVal)
. - To read an observable value, do:
ctx.scope[key]()
. - To track an observable's state, do:
ctx.scope[key](function (newVal) {})
.
install
With npm do:
npm install attr-bind
license
MIT