mardi 29 août 2017

Why isn't an HTTP request being issued when the route changes?

I have an Ember project with the following router:

import Ember from 'ember';
import config from './config/environment';

const Router = Ember.Router.extend({
  location: config.locationType,
  rootURL: config.rootURL
});

Router.map(function() {
  this.route('index', {path: '/'}, function() {
    this.route('folder', {path: 'folder/:folder_id'});
  });
});

export default Router;

The contents of routes/index/folder.js are as follows:

import Ember from 'ember';

export default Ember.Route.extend({
  model(params) {
    console.log(params);
    return this.store.query('message', {folder_id: params.folder_id});
  }
});

My expectation is that when the route changes to /folder/1, the model() method will be invoked to fetch the messages for the folder.

However, this does not occur. The route indeed changes, but the model() method is never invoked (nothing is written to the console).

What am I missing?




Aucun commentaire:

Enregistrer un commentaire