jasongonzales
jasongonzales

Reputation: 1597

Ember.js history not working after transitionTo

please see this functioning JSBin: http://jsbin.com/acUm/20

Here is the behavior I am working on. If I type 'Monroe' to filter the list down and then hit the browser back button, I expect Ember to process the route and fire the request for all patients. Instead it appears to do nothing. This is especially confounding since the back button seems to work in other areas.

Perhaps I have set up this transition improperly? Or is this an Ember.js bug?

Upvotes: 0

Views: 361

Answers (1)

Marcio Junior
Marcio Junior

Reputation: 19128

When you transition to a route, it's a good idea to use the childest route in the hierarchy.

In your case you have this:

this.resource('patients', { path: '/' }, function() {
  // this is created for you
  // this.route('index');
  this.route('filtered', { path: '/filtered/:last_name' });
});

By default is created a route index for that resource, so you have the patients.index. But your transition goes to patients and it isn't the childest.

So to correct this, I have changed your sample to use PatientsIndex[Controller,Router etc], instead of Patients[Controller,Router etc].

Working demo http://jsbin.com/acUm/24/edit

Upvotes: 2

Related Questions