I am trying to dynamically change the templateUrl
in the route. The problem is that in my function, the $rootScope
with its parameter is not available.
Does someone has an idea to solve that?
angular.module('name').config(function ($routeProvider) {
$stateProvider.state('tickets', {
url: "/tickets",
templateUrl: checkPartnerType,
controller: 'TicketListController'
})
});
function checkPartnerType($rootScope){
if( $rootScope.user.partner.type == 'NAT'){
return "core/partials/b2c-ticket-list.html";
}else{
return "core/partials/b2b-ticket-list.html";
}
}