I have a route in my Ember App Kit project that is retrieved from a REST service. This is the code:
var PatientsIndexRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin, { model: function() { return this.store.find('patient').then(function(res) { console.log("success"); return res; }, function() { console.log("error", arguments); }); } }); export default PatientsIndexRoute;
However, when I go to the route ( /patients/index in this case), the page does not seem to do anything. Here is the console:
23:09:46.946 OPTIONS http://localhost:7000/patients/ [HTTP/1.0 200 OK 1ms] 23:09:46.881 "Attempting transition to patients.index" ember.js:3450 23:09:46.883 "Transition #3: patients.index: calling beforeModel hook" ember.js:3450 23:09:46.883 "Transition #3: patients.index: calling deserialize hook" ember.js:3450 23:09:46.948 GET http://localhost:7000/patients/ [HTTP/1.0 200 OK 4ms] 23:09:46.911 "success" app.js:171 23:09:46.912 "Transition #3: patients.index: calling afterModel hook" ember.js:3450 23:09:46.912 "Transition #3: Resolved all models on destination route; finalizing transition." ember.js:3450 23:09:46.915 "generated -> controller:patients.index" [object Object] ember.js:3450 23:09:46.918 "Transition #3: patients.index: transition was aborted" ember.js:3450
Note transition was aborted : this is a generic message displayed whenever a transition is aborted, however I cannot determine from which the transition was canceled. I do not think that it was interrupted while retrieving the model, but some time after afterModel or setupController .
Interestingly, if I remove the model function, it will go to the route. Also strange: it displays the packaging templates/patients.hbs , but not the templates/patients/index.hbs .
EDIT 1: Here is the router:
var Router = Ember.Router.extend(); / Router.map(function() { // Auth-example this.route('index', { path: '/' }); this.route('protected'); this.route('login'); this.resource('patients', function() { this.route('new'); }); }); export default Router;
samuraisam
source share