arturadib / agility

Javascript MVC for the "write less, do more" programmer
http://agilityjs.com
MIT License
542 stars 70 forks source link

Multiple binds? #98

Closed texdc closed 6 years ago

texdc commented 11 years ago

I'm evaluating agility and have a couple questions:

<nav data-bind="menus" data-bind="id=name" />
<!-- OR... -->
<nav data-bind="menus id=name" />
var nav = $$({
    model: {name: '', menus: []},
    view: $("#tpl-nav").html()
});
phonovision commented 11 years ago

How to bind multiple properties to a single DOM element?

The second one should work if you use a comma as seperator:

<nav data-bind="menus, id=name" />

See also #63

How to handle properties that are arrays?

The only way I know is to iterate throug the array, for example by a controller method. If someone knows a better option I would appreciate it ;-)