If you want to load data from outside your application code, you can do it as follows:
Add the preload function to the document (below all your app.js and store.js):
<script> window.preload = function(store) { store.loadMany(App.Post,[10,11],[{ id: 10, content: "testcontent", author_id: 1 },{ id: 11, content: "testcontent2", author_id: 1 }]); store.load(App.User,{ id: 1, username: "supervisor"}); } </script>
In ApplicationRoute, you call the preload function with the repository as a parameter.
App.ApplicationRoute = Ember.Route.extend({ setupController: function(controller, model) { window.preload(this.store); } });
Thus, you reduce the number of requests that are executed during application initialization.
source share