When I pass /?preview=true
in my function and catch it in app.js with $route.current.params.preview
, it appears to be undefined when outputting to the console log. Can someone please assist me in resolving this error?
Below is blah.js which will navigate to
http://localhost:9000/?preview=true
.
var buildLangPathUrl = function () {
return LANG_PATH ? LANG_PATH + '/' : '/';
};
this.openFrontPageWithPreview = function () {
$rootScope.openPage(buildLangPathUrl() + '?preview=true');
};
app.js
$rootScope.$on('$routeChangeSuccess', function (user) {
var path = $location.path();
$rootScope.showIndex =
path === LANG_PATH + '/';
if ($rootScope.showIndex) {
pageService.setPageMetaData('');
if($rootScope.loggedUser) {
console.log($route.current.params.preview); << 'undefined'
if (!$route.current.params.preview) {
routeService.openSuggestedJobs()
}
}
}
});