Ember.js Initializers to Preload Data
Use an ember application initializer with deferReadiness and advanceReadiness to ensure that you have all the data your app requires to boot up.
App.initializer({
  name: "preload",
  initialize: function() {
    App.deferReadiness();
    Ember.$.getJSON("/preload.json", function(json) {
      App.handlePreloadData(json);
      App.advanceReadiness();
    });
  }
});Written by Benjamin Rhodes
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Ember.js 
Authors
ryrych
11.98K
michalbryxi
6.831K
Related Tags
#ember.js
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#