I have two Models Admin and User
My application template is as follow
//application.hbs
{{outlet}}
{{header-nav}}
What I want to do (if it is possible) to make {{header-nav}} customizable, I explain :
If the admin authenticate I want to render the component {{admin-header}}
in the case the user authenticate it should render {{user-header}}.
How can I build what to render in application.hbs dynamically ?
You could define
isAdmincomputed property in Application Controller:or you could wrap it as
header-navcomponent withisAdminproperty, so:UPDATE (Details with ember-simple-auth for @Grimmy)
1) Inject
currentUserintosession(for example, https://stackoverflow.com/a/30894082/4950029)2) Resolve
currentUserinbeforeModelhook and setcurrentUsercontroller property:or as answered above