mardi 21 novembre 2017

what are ember js static data best practices

I have some static data which will never change, like the data behind menu items

{
  "menuItems": [{
    "name": "Shows",
    "route": "shows"
  }, {
    "name": "Podcasts",
    "route": "podcasts"
  }]
}

i created a json file in /dist folder and in the application route i'm creating a model from the file like

export default Route.extend({
  model() {
    return $.getJSON('/static/model.json')
  }
});

is there a better practice to initialize model with static data?




Aucun commentaire:

Enregistrer un commentaire