Quantcast
Viewing all articles
Browse latest Browse all 4827

Creating a route once and reuse it in subroutes without totally exiting from the actual subroute

@zoltan wrote:

Let's say you have a routable modal dialog where you have a complex form or feature. This dialog might have more steps, so it can have subroutes. This dialog can appear across your pages when you click a button. Of course, the user should see the background content, the page, the subpage, what they visited before clicking the button. Meanwhile, the dialog appears over the content.

A route map example:

Router.map(function () {

  this.route('modal-dialog', function() {
    this.route('step-one');
    this.route('step-two');
  });

  this.route('page-one');
  this.route('page-two');
  this.route('page-three', function() {
    this.route('subpage-one');
    this.route('subpage-two');
  });
});

You have a button on each page and subpage. If you redirect the user to the modal-dialog route (and the dialog renders in a different outlet of course), the normal behaviour is the dialog appear, but Ember is exiting from the subroute and the background content disappears. However, if you close the dialog, Ember goes back to the original subroute and the content is there again.

The question is, how can we implement a common or shareable route, what you can inject wherever you want, keeping that context.

I tried out this addon: https://github.com/nathanhammond/ember-route-alias which is quite good, but it is not really solving this problem and it looks, I cannot use a route as alias in a subroute if it created on the main route.

I feel, we can solve this use case only with touching something under the hood... any idea? Image may be NSFW.
Clik here to view.
:slight_smile:

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4827

Trending Articles