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) {
|
app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $state, Auth, $location) {
|
||||||
$rootScope.urlCrumbs = [];
|
$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) {
|
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
|
||||||
var requiresLogin = toState.data.requiresLogin;
|
var requiresLogin = toState.data.requiresLogin;
|
||||||
var Crumbs = new Object();
|
|
||||||
Crumbs = {
|
Crumbs = {
|
||||||
absUrl: $location.$$absUrl,
|
absUrl: decodeURIComponent($location.$$absUrl),
|
||||||
url: $location.$$url,
|
url: decodeURIComponent($location.$$url),
|
||||||
path: $location.$$path,
|
path: decodeURIComponent($location.$$path),
|
||||||
params: $location.$$search,
|
params: decodeURIComponent($location.$$search),
|
||||||
toPath: toState.url,
|
toPath: decodeURIComponent(toState.url),
|
||||||
fromPath: fromState.url
|
fromPath: decodeURIComponent(fromState.url)
|
||||||
};
|
};
|
||||||
console.log('crmb obj ->', Crumbs);
|
|
||||||
$rootScope.urlCrumbs.push(Crumbs);
|
$rootScope.urlCrumbs.push(Crumbs);
|
||||||
console.log('CRUMBS ->', $rootScope.urlCrumbs);
|
console.log($rootScope.urlCrumbs);
|
||||||
|
|
||||||
if (requiresLogin && !Auth.isLoggedIn()) {
|
if (requiresLogin && !Auth.isLoggedIn()) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$state.go('splash-page', { 'toState': toState.name });
|
$state.go('splash-page', { 'toState': toState.name });
|
||||||
|
|
Loading…
Reference in New Issue