mardi 14 novembre 2017

Ember.js load data on template

I want to load data from model to template in ember as shown in code

        import Ember from 'ember';
         const { Route, RSVP, set } = Ember;
          export default Ember.Route.extend({
          csvDataService: Ember.inject.service(),
          apiService: Ember.inject.service(),
          selectedDescription:"",
            model() {
            const performanceIndicatorData = this.get('csvDataService').getPerformanceIndicatorData();
            const sites = this.store.findAll('site');
            const units = this.store.findAll('unit');
            const components = this.store.findAll('component');
            const advice=apiService.get("advice-list").then((res)=> { return res;},(error) => {});

            return Ember.RSVP.hash({
              performanceIndicatorData, sites, units, components,advice
                });
          },
          setupController(controller, model) {
              set(controller, 'sites', model.sites);
              set(controller, 'units', model.units);
              set(controller, 'components', model.components);
              set(controller, 'performanceIndicatorData', model.performanceIndicatorData);
              set(controller, 'advice', model.advice)
           },

    })

As shown in above code from model to template , I am returning complete promise after getting the data so how can I return one by one data so that whatever data will come from backed , it will not wait for entire data, it render to template




Aucun commentaire:

Enregistrer un commentaire