Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4826

Ember index and application templates

$
0
0

@belgoros wrote:

I can’t really figure out how to work with index and application templates, - there is something unclear about their behaviour. Here are some extracts from Ember guides.

  1. The index template will be rendered into the {{outlet}} in the application template.
  2. At every level of nesting (including the top level), Ember automatically provides a route for the / path named index.
  3. The application route is entered when your app first boots up. Like other routes, it will load a template with the same name (application in this case) by default. You should put your header, footer, and any other decorative content here. All other routes will render their templates into the application.hbs template’s {{outlet}}.

So, following the above guide lines, I modified application.hbs template to contain the navbar with login/logout buttons. Then, after the User signed in, I redirect it to dashboard route and in this case the dashboard.hbs template gets injected into {{outlet }} in the application.hbs template.

The problem I have is as follows:

  1. If I use links only to navigate between different routes and pages in my app, it works fine.
  2. If I change the URL manually in the browser to http://localhost:4200, I have an empty page with just the navbar without the content of dashboard template.

How to do in this case ? I’m using ESA as authentication add-on and redirect the user to dashboard route after authentication:

#environment.js

ENV['ember-simple-auth'] = {
    routeAfterAuthentication: 'dashboard'
  };

Any ideas ? Thank you.

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles