I have an Ember project and there is a template under application
.
So, it would look like app/application/template.hbs
.
This template contains the website’s navbar and has an {{outlet}}
for other template code.
I have a login page where I don’t want this navbar to show up. Is there a recommended way to not have the application
template rendered in this case? I can add javascript to hide the navbar but I’m guessing this is not the best solution.
I’d typically use a session to track the user’s authentication status (amongst other things) then you can just do something like:
{{#if session.isAuthenticated}}
{{nav-bar}}
{{/if}}
Instead of making application the root of the main application make a new route, I usually use restricted, as the base. You then setup your application UI under restricted and you can put login alongside.
application - login
\- restricted (main app UI in this template)
\- users
\- accounts
\- …
You can use {path: '/'}
on restricted and {resetNamespace: true}
to “fixup” your URL structure.