How to hide blocks for a route while going to a subroutine

0

I'm using Ember 2 and things are complicated for those who have no Ember experience. I have the following routes

consultas\

consultas\reserva

And on my router.js it's like this

this.route('consultas', function() {
    this.route('reservas');
}

The query template has some information I want to hide when I go to the booking template. How can I do this in Ember 2.0 or how do I know which route I am when calling my helper to do this?

I asked the same question in SOEN. If you would like to join the answers .

    
asked by anonymous 28.10.2015 / 15:37

1 answer

2

You could have the following template structure:

  

consultas.hbs
  queries / index.hbs
  queries / reservations.hbs

In queries.hbs there would be {{outlet}} . When you were in the routing queries, Ember would render the queries / index.hbs in this {{outlet}} . When you were on the queries / reservations route, Ember would render the queries / reservations.hbs in {{outlet}} .

In this way, everything in index.hbs would be shown in the parent route, but not in the subroutine. Just put what you want to hide in index.hbs .

However, this would only work well for contiguous blocks of code. If the information you want to hide is heavily scattered in the template, it may be best to use a variable in the route queries to define when they should be shown, and use willTransition to detect when you are entering the child route.

    
11.10.2016 / 19:23