working link in view's format

11 views
Skip to first unread message

Luis Gonzalez

unread,
Feb 11, 2013, 2:40:51 AM2/11/13
to Agility.js
I have an agility object whose model has two properties: "link" and
"name".
I tried many ways to construct a working link right in the view's
format, but I couldn't find the way to do it by using data-
bind="link".
So I finally made it in the controller, on "create" as follows:

movie = $$({
model: {},
controller: {
'create': function() {
var link = this.model.get("link");
var name = this.model.get('name');
this.view.$().html("<li><a href='" + link + "'>" + name + "</
a></li>");
},
}
});

How would be the proper way of creating a proper link, using the
model's properties, right in the view?

Luis Gonzalez

unread,
Feb 11, 2013, 3:01:11 AM2/11/13
to Agility.js
...nervermind, I finally found the way:

view: {
format: '<li><a data-bind="name, href=link">'
},
Reply all
Reply to author
Forward
0 new messages