fixing path weirdness
This commit is contained in:
parent
77a97ddcfc
commit
a3cb728afd
31
js/app.js
31
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 });
|
||||
|
|
Loading…
Reference in New Issue