Jed
Jed

Reputation: 703

Unbound version of bindAttr in emberjs handlebars template

In cases where binding isn't needed, we can use {{unbound someProperty}}, but is there a way to achieve the same effect with tag attributes? As I understand it, our only option is bindAttr such as:

<img {{bindAttr src="thumbpath"}} />

Assuming 100+ images on the screen, and a somewhat frequent re-rendering (of the entire layout- not just the images), would there be any performance benefit in an unbound version?

Upvotes: 17

Views: 4334

Answers (1)

Dan Gebhardt
Dan Gebhardt

Reputation: 3281

Because Ember doesn't need to track unbound values, you can actually just do this:

<img src="{{unbound thumbpath}}" />

And yes, there are performance benefits to using unbound values.

Upvotes: 39

Related Questions