Skip to content Skip to sidebar Skip to footer

Access Browsing History In Ember

I have the following two paths to edit an object (node) in my application: List nodes -> click edit icon List nodes -> select node -> click edit button I have the option

Solution 1:

Reopen Ember.Route to store the currentPath when a route is exited:

Ember.Route.reopen({
  deactivate: function() {
    var applicationController = this.controllerFor('application');
    App.previousPath = applicationController.get('currentPath');
  }
});

Then in your cancel method:

goBack: function () {
    if (SettingsApp.previousPath == 'nodes.show') {
        this.transitionToRoute(SettingsApp.previousPath, this.get('content'));
    } else {
        this.transitionToRoute(SettingsApp.previousPath);
    }
},

cancel: function () {
    this.stopEditing();
    this.goBack();
},

Note: you might want to provide some fallback in case the app is loaded in the nodes.edit route.

Post a Comment for "Access Browsing History In Ember"