Navigation problem


#1

topmost.navigate() doesn’t work on my login page when i navigate to the page with this function from the main -page which is my application-start page

if(token == undefined){
        frameModule.topmost().navigate({
                    moduleName: "./pages/login/login",
                    animated: true,
                    transition: {
                    name: "fade",
                    duration: 0,
                    curve: "linear"
                    }});
}

#2

I have not tested the sample, and do not notice any evident problems with the code, but I’d like to ask you to share any errors, exceptions, or logs that you think are relevant, when asking for help with a certain issue.

Thanks!


#3

no error or exception is reported.I hit all the buttons on the loaded screen and it just doesn’t fire the topmost.navigate()


#4

Could token be defined, then, and the code skips the frameModule.topmost().navigate() function call?


#5

trying to create a single login logic into the app…so if token is defined it should skip login page…


#6

console log the token value before the conditional statement to verify that you are entering the closure at all.


#7

done that…my condition works but its the page i am navigated to that has the topmost.navigate() issue


#8

solved
if(token !== undefined){
application.start({ moduleName : “./main-page”})
}
else
{
application.start({moduleName : “/pages/login/login”})
}


#9

Solved

Make sure in your main-page.xml navigatingTo=“onNavigatingTo” still there
and then in your main-page.js put your code inside function onNavigatingTo(args) {} ,so it will be like this:

function onNavigatingTo(args) {
if(token == undefined){
frameModule.topmost().navigate({
moduleName: “./pages/login/login”,
animated: true,
transition: {
name: “fade”,
duration: 0,
curve: “linear”
}});
}
}

exports.onNavigatingTo = onNavigatingTo;