Deewendra Shrestha
Deewendra Shrestha

Reputation: 2465

bind attribute within a component leaking to other components in ember

I have a component that I load multiple times in a page. And I am binding class to one of the elements in the component based on a property of the component. A simple example that demonstrates the issue is here : http://jsbin.com/iKabiKi/1/

You can see in the example that if I click on one of the links, the class is changed to all the other component elements!

I am not sure if I am doing things wrong or if this is a bug. Your insight will be much appreciated.

Thanks, Dee

Upvotes: 0

Views: 70

Answers (1)

Kingpin2k
Kingpin2k

Reputation: 47367

Arrays are initiated and live on the class, not the instance. Initialize it during init, or somewhere else to avoid this issue.

http://jsbin.com/iKabiKi/2/edit

Upvotes: 2

Related Questions