Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

How To Use Return Value from Controller in Route?

$
0
0

@bcgreen24 wrote:

I have this controller (controllers/movies.js):

import Ember from 'ember';

export default Ember.Controller.extend({
  queryParams: ['t'],
  actions: {
    findMovie() {
      let value = this.get('value');
      return this.get('store').queryRecord('movie', {
        t: value,
       r: 'json'
      });
    }
  }
});

…that is triggered by the click event on a button. It is triggered just fine, and I can see the data being retrieved in my browser’s inspector. So-- in my route (routes/movies.js), how do I access the data returned by the controller?

import Ember from 'ember';

export default Ember.Route.extend({
  model() {

  }
})

I’ve just started learning Ember, and originally I had my store query in the route with the ‘t’ parameter hard-coded, and it worked fine. But now that I’ve moved the query logic into a controller, I have no idea how to pass the resulting JSON back to my route’s ‘model()’ method…

Thanks! Bryan

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles