I'm developing a project and I'm using Angular, I need that when I access the internal page, the menu is selected, until the beauty, but problem is when the internal page contains slug or some inner internal, the code I'm using :
Html:
<li class="waves-effect waves-light" ng-class="(url_atual == '/module9'? fundo_selecionado:fundo_normal)">
<img src="app/template/img/col.png">
<p>Colaboradores</p>
</li>
Controller:
$scope.url_atual = $location.url();
$scope.fundo_selecionado = 'fundo_selecionado';
$scope.fundo_normal = 'fundo_normal';
CSS:
.fundo_selecionado{
background-color: #fff!important;
}
.fundo_normal{
background-color: $cor_cinza!important;
}
As you can see, I use an ng-class and if the current url is equal to the module accessed, it plays the class deep_selected, else it plays the bottom_normal class. The problem is when I have built-in module, such as / module9 / internal or module9 / slug so it does not keep the selected menu. Does anyone have a clue how I can keep the menu selected even inside the modules?
Following route system:
function Config($routeProvider) {
$routeProvider
.when('/module9', {
templateUrl: 'module9/template/index.html',
controller: 'module9Controller',
controllerAs: 'vm'
})
.when('/module9/:module9Slug', {
templateUrl: 'module9/template/interna.html',
controller: 'module9Controller',
controllerAs: 'vm'
})
.when('/module9/adicionar/add', {
templateUrl: 'module9/template/adicionar.html',
controller: 'module9Controller',
controllerAs: 'vm'
});
}