5
votes

I have an emberjs app that is structured very much like the sample here: https://github.com/tildeio/bloggr-client

The question I have is that when the user clicks on a 'post' on the left, is there any event I can subscribe to in the post view/route/controller that i can tap into? A javascript library I'm using (gridster) requires some javascript to be run as the user switches from post to post. I've tried using didInsertElement but that doesn't seem to fire (using 1.0.5)

1
sounds like more of a job for the router/controllerj_mcnally
@j_mcnally which event / method would I use for that?Ben

1 Answers

6
votes

You can observe the PostController's content property. This can be done from anywhere that has access to the PostController. For example, from PostView:

App.PostView = Ember.View.extend({
  templateName: 'post',
  contentDidChange: function() {
    console.log('content changed to: ', this.get('controller.content'));
  }.observes('controller.content')
})