假设我有这样的观点:
App.AnchorView = Ember.View.extend({
tagName: 'a',
attributeBindings: ['href']
});
和一个类定义:
App.Item = Ember.Object.extend({
name: "Unknown Entry",
location: ""
});
和类的一个实例:
App.Item.create({
name: "Google",
location: "http://www.google.com"
});
我的模板是:
{{#view App.AnchorView}}{{name}}{{/view}}
我希望它呈现为:
<a href="http://www.google.com">Google</a>
我怎么做?