Question

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)

Was it helpful?

Solution

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')
})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top