Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider, $rootScope) {
- $urlRouterProvider.otherwise('signin');
- $stateProvider.state('site', {
- 'abstract': true,
- resolve: {
- authorize: ['authorization', function (authorization) {
- return authorization.authorize();
- }, ]
- }
- })
- .state('signin', {
- parent: 'site',
- url: '/signin',
- data: {
- roles: (function () {
- //principal.GetRoles(); --> in the below line i am returning hardcoded array value but i have take that array value from below principle factory
- return ['Dev','Admin'];
- })()
- },
- views: {
- '': { templateUrl: '/signin.html' },
- 'content@': {
- templateUrl: '/index.html',
- controller: 'SigninCtrl'
- }
- },
- })}
- ])
- .factory('principal', ['$q', '$http', '$timeout', '$cookieStore', '$cookies', function ($q, $http, $timeout, $cookieStore, $cookies) {
- var _identity = undefined,
- _authenticated = false;
- return {
- isIdentityResolved: function () {
- return angular.isDefined(_identity);
- },
- isAuthenticated: function () {
- return _authenticated;
- },
- RedirectUrl: function (absUrl) {
- $cookieStore.put('RedirectUrl', absUrl);
- return true;
- },
- GetRoles: function () {
- return ['Dev','Admin']
- },
- }
- ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement