I need to change bavbar template depending on current state, but I cannot access to state from component.
import template1 from './navbar.html';
import template2 from './navbar_logged.html';
import controller from './navbar.controller';
import './navbar.scss';
let navbarComponent = {
restrict: 'E',
bindings: {},
template: function($state) {
if($state.current.name === 'store') {
return template2;
}
},
controller,
controllerAs: 'vm'
};
navbarComponent.$inject = ['$state'];
export default navbarComponent;
It does not work this way, because $state is always undefined