user1338121
user1338121

Reputation: 805

Bind custom attributes on Ember view with controller data in xhandlebars script

{{#each App.SampleViewController}}
     {{#view App.SampleView contentBinding="this" sort-date="content.sortDate" name="content.name"}}
            <a href="#" onclick="App.loadSampleDetails(this);" {{bindAttr id="content.id"}}>
         {{/view}}
    {{/each}}

How to add custom attributes/generic attributes (like in the above example sort-date/name attributes) to the view element from the xhandlebars script tag, I know that using attributeBindings we can add, but I have the dynamic data coming from controller through each.

Upvotes: 0

Views: 2773

Answers (1)

ebryn
ebryn

Reputation: 4407

You can use the attributeBindings property to define additional attributes that will get added to the DOM output for a view. See the "HTML Attributes" section in the Ember.View docs: http://docs.emberjs.com/#doc=Ember.View&src=false

Upvotes: 1

Related Questions