Reputation: 1065
I am trying to work out how to do the following:
Situation: User opens website.com
A) If user is logged in, he is shown the "welcome template".
B) If user is not logged in, he is shown the "login template".
I don't want to URL in the browser to change, it should stay as website.com for both outcomes.
How can I get this route setup?
Upvotes: 0
Views: 40
Reputation: 47367
You can use an if statement. You'd need to put the isNotLoggedIn logic on the appropriate controller (probably application).
{{#if isNotLoggedIn}}
{{render 'login'}}
{{/if}}
I do agree with Grapho though, this is an anti-pattern in Ember (where a url represents what you will see), and doesn't do a good job of separating your concerns (single responsibility). But if you are being told to do it and have no say in the matter.
Upvotes: 2