fixing path weirdness

This commit is contained in:
Jon Lambson 2017-11-13 14:27:18 -07:00
parent 77a97ddcfc
commit a3cb728afd
1 changed files with 22 additions and 9 deletions

View File

@ -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 });