I have an API which returns an array, which I want to use inside route Config of my $stateProvider
... but am unable to do so.
Can someone help me, I have tried using localStorage
and $rootScope
Below in my code snippet:
(function() {
'use strict';
angular.module('Admin.pages.masters', ['ui.select', 'ui.bootstrap', 'ngSanitize'])
// .run(function($rootScope){
// $rootScope.arr = ['System Admin','System Manager', 'System User'];
// })
.config(routeConfig);
/** @ngInject */
function routeConfig($stateProvider, $httpProvider) {
//localStorageServiceProvider.setStorageType('localStorage');
//console.log(localStorage.getObject('userData'));
$httpProvider.interceptors.push('authInterceptor');
$stateProvider
.state('main.master', {
url: '/master',
template: '<ui-view autoscroll="true" autoscroll-body-top></ui-view>',
abstract: true,
title: 'Masters',
sidebarMeta: {
icon: 'icoMasters',
order: 2,
},
authenticate: true,
params: { // <-- focusing this one
authRoles: ['System Admin', 'System Super Admin'] // <-- roles allowed for this module
}
})
.state('main.master.license', {
url: '/license',
template: '<ui-view autoscroll="true" autoscroll-body-top></ui-view>',
title: 'Customer License',
sidebarMeta: {
order: 0,
},
authenticate: true,
params: { // <-- focusing this one
authRoles: ['System Admin', 'System Super Admin'] // <-- roles allowed for this module
}
})