Clicking the link should redirect me back to the main index page /
from the /:id
path. However, when I use the browser back button, the page does not reload properly. The link itself appears correct as href="/"
. Interestingly, in other sections of the application, such as navigating back from /new
to the index, the same {{link-to}}
helper functions without any issues.
import Ember from 'ember';
import config from './config/environment';
var Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('conversations', {path: '/'}, function() {
this.route('new');
this.route('conversation', {path: '/:conversation_id'});
});
});
export default Router;
Back Button in conversation template:
{{#link-to 'conversations'}}
Conversation Route:
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return Ember.RSVP.hash({
conversation: this.store.find('conversation', params.conversation_id),
messages: this.store.find('message')
});
}
});
Conversations Index Route:
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.findAll('conversation');
}
});