简体   繁体   中英

Creating Ember.js application

I am trying to create application with Ember.js, but without storing the data, i want to have all my routes and templates defined before. For example, i want to have menu and when clicking on it i want different parts of code rendered, but without storing data with ember data or whatever else, like it is in code below. Does anyone have tutorial or code that helps me with this?

 App.IndexRoute = Ember.Route.extend({
   model : function(){
    var stories = this.get('store').findAll('story');
    return stories;
  }
});

If you want hardcoded data, just return whatever objects/arrays you want to use from the model hook.

App.IndexRoute = Ember.Route.extend({
   model : function() {
    return {
      title: "Some title",
      whatever: []
    };
  }
});

If you don't need data at all, don't return anything. You should, however, still have model: hook, because otherwise Ember will try to create one for you, using main data store.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM