Ember.js adds an observer when content is fully loaded

You have problems setting up my observer settings. The following code works fine in the sense that it seems to be correctly following the length property. However, it fires repeatedly while the page is loading, which is not what I expect / want. Is there any way to add this observer at full load?

App.PlaylistController = Ember.ObjectController.extend({
  songsChanged: function() {
   // some behaviour
  }.observes('content.songs.length'),
});

What is it for, this.get ('content.isLoaded'); returns true on page load

App.PlaylistController = Ember.ObjectController.extend({
  songsChanged: function() {
   this.get('content.isLoaded');
  }.observes('content.songs.length'),
});
+4
source share
1 answer

You can dynamically add and remove observers in ember using Ember.Observable.addObserver and Ember.Observable.removeObserver respectively.

, , content.isLoaded, 'content.songs.length', addObserver.

0

All Articles