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 may use
{{component}}
helper, but you need to have component name determined first, so, in your controller:Then, in your template:
It was designed and introduced short time ago for such use cases.
You can also go more fancy: