Since I am working out login I have such kind of code using ember-simple-auth
{{#if session.isAuthenticated}}
<!-- Show editing controls intended for logged in user -->
{{outlet}}
{{else}}
<!-- Show only the stuff normal users should see -->
{{outlet}}
{{/if}}
But it would trigger that two outlet will be rendered sometimes.
{{#if session.isAuthenticated}}
<!-- Show editing controls intended for logged in user -->
{{outlet}}
{{else}}
<!-- Show only the stuff normal users should see -->
{{outlet login}}
{{/if}}
In the login route we need to add renderTemplate hook
Ember treat outlet not so friendly enough to me. I spend quite a couple of hours to figure out to solve it.
It think two {{outlet}} on the same template is not working cool right now.
Then again, if you’re trying to block access to a page and send the user to the log in page you might be better off using the beforeModel hook in the route file and performing a transition to the log in page.
Sorry I wasn’t clear (was in hurry when I typed that). But couldn’t you have one outlet and move the conditional logic inside of the renderTemplate hook. Example: Ember Latest - JSFiddle - Code Playground
Thanks for you reply and the code , it looks nice. @jasonmit
Just my first instinct that the if else condition inside outlet is not working correct and feel frustrated.
I am new on Ember so hard to figure out using renderTemplate hook and views.
In the Ember Tutorial, it seems that we should avoid using component instead of views.
What object holds state of your session object? Is this session object injected onto your routes and controllers? Are you able to reproduce it and show me an example?
In the RFC for 2.0 there is a migration path towards using components. Generally, you would use components but because you can consider this the view that backs your route/controller its perfectly fine to use a view (think of my example as two Index views).