diff --git a/js/app.js b/js/app.js index 013733a..12324ed 100644 --- a/js/app.js +++ b/js/app.js @@ -156,20 +156,33 @@ app.config([ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $state, Auth, $location) { $rootScope.urlCrumbs = []; + var Crumbs = new Object(); + var param; + console.log('the path', decodeURIComponent($location.$$absUrl)); + Crumbs = { + absUrl: decodeURIComponent($location.$$absUrl), + url: decodeURIComponent($location.$$url), + path: decodeURIComponent($location.$$path), + params: decodeURIComponent($location.$$search), + }; + if (Crumbs.url.includes('%')) { + param = $location.$$path; + } + $rootScope.urlCrumbs.push(Crumbs); + $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { var requiresLogin = toState.data.requiresLogin; - var Crumbs = new Object(); Crumbs = { - absUrl: $location.$$absUrl, - url: $location.$$url, - path: $location.$$path, - params: $location.$$search, - toPath: toState.url, - fromPath: fromState.url + absUrl: decodeURIComponent($location.$$absUrl), + url: decodeURIComponent($location.$$url), + path: decodeURIComponent($location.$$path), + params: decodeURIComponent($location.$$search), + toPath: decodeURIComponent(toState.url), + fromPath: decodeURIComponent(fromState.url) }; - console.log('crmb obj ->', Crumbs); $rootScope.urlCrumbs.push(Crumbs); - console.log('CRUMBS ->', $rootScope.urlCrumbs); + console.log($rootScope.urlCrumbs); + if (requiresLogin && !Auth.isLoggedIn()) { event.preventDefault(); $state.go('splash-page', { 'toState': toState.name });