Last Updated: February 25, 2016
·
2.072K
· nerdyworm

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();
    });
  }
});