N
N
Nice_932017-04-28 13:15:10
JavaScript
Nice_93, 2017-04-28 13:15:10

How to overload the route model in EmberJS from controllera?

there is Controller

export default Ember.Controller.extend({
    surveysApi : Ember.inject.service('surveys-api'),
    actions: {
        deleteSurveys(id){
            this.get('surveysApi').deleteSurvey(id);
        }
    }
});

removes element
Yes Route
model(){
        this.set("disqus",[]);
        return this.get('surveysApi').getSurveys().then(result => {
            disqus = result;
            return disqus;
        });

    },

which also receives data from the service
. How can I reload new data from the controller?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Baev, 2017-04-28
@Nice_93

Added in the route:

actions: {
    refreshModel() {
      this.refresh();
    }
  }

And then from the controller:
this.send('refreshModel');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question