gilgen / ember-pusher

A proper Ember / Pusher integration.
MIT License
99 stars 35 forks source link

multiple uses of a controller #14

Closed jess closed 9 years ago

jess commented 9 years ago

I'm not sure if I'm doing something wrong or if this is a bug?

I have a controller that gets used rendered multiple times on a page.

For example:

// (Emblem js syntax)
each question.comments itemController="CommentsComment"
        partial "comments/comment"

When I extend the CommentsComment controller with EmberPusher.Bindings, subscribe to a channel and push an event, my action / event gets called every time the controller is called in the template. So if my question has 5 comments, my action gets called 5 times.

Am I doing something wrong? Thanks in advance for the help.

mmun commented 9 years ago

Each creates a temporary item controller for each item in the array (they are not shared), so it makes sense that the action fires for each item controller. Maybe you mean to put the bindings on an array controller?