I might have some kind of missunderstanding. Im using angular ui router and i have the next issue:
I have the next State provider:
angular
.module(\'Main
It can sound strange but for me the solution was to rename my state and remove the dot ...
I want an home page different for customer, director, manager or anything ( but with the same url )
.state('home', {
url : '/',
templateUrl: 'views/home.html',
controller: 'HomeCtrl',
controllerAs: 'home',
module :'private'
})
.state('home.customer', {
url : '',
templateUrl: 'views/home-customer.html',
controller: 'HomeCustomerCtrl',
controllerAs: 'homeCustomer',
module :'private'
})
.run(function ($rootScope, $state, $window,userService) {
$rootScope.$on("$stateChangeStart", function(e, toState, toParams, fromState, fromParams) {
if(toState.name === 'home') {
if(userService.isCustomer()) {
$state.go('home.customer');
}
}
}
This dosen't work, replace the name home.customer
state with home-customer
and $state.go('home-customer');
and it works ...