Ionic 4 Angular router navigate and clear stack/history of previous pageIn Angular, how do you determine the active route?Ionic 2 - Side menu with navigation between pages (back button)Clear all queryParams with new Router v3 Angular2Ionic Components are not destroyed after navigate to another pageIssue with Ionic 4 angular page eventsStrange Routing Issue Angular 7 + Ionic 4 Betaionic 4 + angular: routerLink only works first timeIonic 4: How to set navigation direction (backward/forward) using routerLink?Navigate to root without back in ionic 4ionic 4 angular navigate as the set root and as the back button

How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?

Simulate Bitwise Cyclic Tag

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

how to create a data type and make it available in all Databases?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

What typically incentivizes a professor to change jobs to a lower ranking university?

Modification to Chariots for Heavy Cavalry Analogue for 4-armed race

Can you lasso down a wizard who is using the Levitate spell?

How do we improve the relationship with a client software team that performs poorly and is becoming less collaborative?

Why does not dark matter gather and form celestial bodies?

Should I join an office cleaning event for free?

What is the offset in a seaplane's hull?

"which" command doesn't work / path of Safari?

Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?

Can a German sentence have two subjects?

DOS, create pipe for stdin/stdout of command.com(or 4dos.com) in C or Batch?

If Manufacturer spice model and Datasheet give different values which should I use?

Is it legal to have the "// (c) 2019 John Smith" header in all files when there are hundreds of contributors?

Why is an old chain unsafe?

Non-Jewish family in an Orthodox Jewish Wedding

How can bays and straits be determined in a procedurally generated map?

Copenhagen passport control - US citizen

Download, install and reboot computer at night if needed

When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?



Ionic 4 Angular router navigate and clear stack/history of previous page


In Angular, how do you determine the active route?Ionic 2 - Side menu with navigation between pages (back button)Clear all queryParams with new Router v3 Angular2Ionic Components are not destroyed after navigate to another pageIssue with Ionic 4 angular page eventsStrange Routing Issue Angular 7 + Ionic 4 Betaionic 4 + angular: routerLink only works first timeIonic 4: How to set navigation direction (backward/forward) using routerLink?Navigate to root without back in ionic 4ionic 4 angular navigate as the set root and as the back button






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm developing an app using Ionic 4 with Angular router. I would like to navigate to another page and clear the page stack. In Android native, it's something like this:



Intent intent = new Intent(NewActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);


From what I've read so far, it is possible using Ionic NavController but it is deprecating in Ionic 4. I learnt about buttons with routerLink but if I'm not mistaken, by using that the app will immediately navigate to the other page. I need to execute some logic before navigating to another page .



For example: Login page. After successful login, the user shouldn't be able to go back to the login page. Also, by clicking the 'login' button, it should call a function to process the login and decide to navigate/not navigate to another page.



Is there any way that I can achieve this with Angular router or do I need to rely on the deprecating Ionic NavController?










share|improve this question

















  • 1





    I had to kneel down to NavController for this issue. its not fully deprecated, you can still use it. or else you can use ionViewWillLeave() to empty your stack.

    – Najam us saqib
    Mar 8 at 7:19











  • @Najamussaqib I guess until I found the solution for Angular router, I'll just use NavController for now

    – tyn
    Mar 11 at 2:38


















0















I'm developing an app using Ionic 4 with Angular router. I would like to navigate to another page and clear the page stack. In Android native, it's something like this:



Intent intent = new Intent(NewActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);


From what I've read so far, it is possible using Ionic NavController but it is deprecating in Ionic 4. I learnt about buttons with routerLink but if I'm not mistaken, by using that the app will immediately navigate to the other page. I need to execute some logic before navigating to another page .



For example: Login page. After successful login, the user shouldn't be able to go back to the login page. Also, by clicking the 'login' button, it should call a function to process the login and decide to navigate/not navigate to another page.



Is there any way that I can achieve this with Angular router or do I need to rely on the deprecating Ionic NavController?










share|improve this question

















  • 1





    I had to kneel down to NavController for this issue. its not fully deprecated, you can still use it. or else you can use ionViewWillLeave() to empty your stack.

    – Najam us saqib
    Mar 8 at 7:19











  • @Najamussaqib I guess until I found the solution for Angular router, I'll just use NavController for now

    – tyn
    Mar 11 at 2:38














0












0








0








I'm developing an app using Ionic 4 with Angular router. I would like to navigate to another page and clear the page stack. In Android native, it's something like this:



Intent intent = new Intent(NewActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);


From what I've read so far, it is possible using Ionic NavController but it is deprecating in Ionic 4. I learnt about buttons with routerLink but if I'm not mistaken, by using that the app will immediately navigate to the other page. I need to execute some logic before navigating to another page .



For example: Login page. After successful login, the user shouldn't be able to go back to the login page. Also, by clicking the 'login' button, it should call a function to process the login and decide to navigate/not navigate to another page.



Is there any way that I can achieve this with Angular router or do I need to rely on the deprecating Ionic NavController?










share|improve this question














I'm developing an app using Ionic 4 with Angular router. I would like to navigate to another page and clear the page stack. In Android native, it's something like this:



Intent intent = new Intent(NewActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);


From what I've read so far, it is possible using Ionic NavController but it is deprecating in Ionic 4. I learnt about buttons with routerLink but if I'm not mistaken, by using that the app will immediately navigate to the other page. I need to execute some logic before navigating to another page .



For example: Login page. After successful login, the user shouldn't be able to go back to the login page. Also, by clicking the 'login' button, it should call a function to process the login and decide to navigate/not navigate to another page.



Is there any way that I can achieve this with Angular router or do I need to rely on the deprecating Ionic NavController?







angular ionic-framework ionic4 angular-router






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 6:12









tyntyn

85112




85112







  • 1





    I had to kneel down to NavController for this issue. its not fully deprecated, you can still use it. or else you can use ionViewWillLeave() to empty your stack.

    – Najam us saqib
    Mar 8 at 7:19











  • @Najamussaqib I guess until I found the solution for Angular router, I'll just use NavController for now

    – tyn
    Mar 11 at 2:38













  • 1





    I had to kneel down to NavController for this issue. its not fully deprecated, you can still use it. or else you can use ionViewWillLeave() to empty your stack.

    – Najam us saqib
    Mar 8 at 7:19











  • @Najamussaqib I guess until I found the solution for Angular router, I'll just use NavController for now

    – tyn
    Mar 11 at 2:38








1




1





I had to kneel down to NavController for this issue. its not fully deprecated, you can still use it. or else you can use ionViewWillLeave() to empty your stack.

– Najam us saqib
Mar 8 at 7:19





I had to kneel down to NavController for this issue. its not fully deprecated, you can still use it. or else you can use ionViewWillLeave() to empty your stack.

– Najam us saqib
Mar 8 at 7:19













@Najamussaqib I guess until I found the solution for Angular router, I'll just use NavController for now

– tyn
Mar 11 at 2:38






@Najamussaqib I guess until I found the solution for Angular router, I'll just use NavController for now

– tyn
Mar 11 at 2:38













1 Answer
1






active

oldest

votes


















0














this.router.navigateByUrl('/login', skipLocationChange: true );


Navigates without pushing a new state into history.



https://angular.io/api/router/NavigationExtras






share|improve this answer























  • It works on browser but not when deployed to device. I wonder why.. I need it to work on devices though.

    – tyn
    Mar 10 at 17:59











  • Update: It actually works but not on root page. Let's say login page is my root page & I'm navigating from login page to home page, it wont work. Login page will still be in history.

    – tyn
    Mar 11 at 3:24











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55057685%2fionic-4-angular-router-navigate-and-clear-stack-history-of-previous-page%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














this.router.navigateByUrl('/login', skipLocationChange: true );


Navigates without pushing a new state into history.



https://angular.io/api/router/NavigationExtras






share|improve this answer























  • It works on browser but not when deployed to device. I wonder why.. I need it to work on devices though.

    – tyn
    Mar 10 at 17:59











  • Update: It actually works but not on root page. Let's say login page is my root page & I'm navigating from login page to home page, it wont work. Login page will still be in history.

    – tyn
    Mar 11 at 3:24















0














this.router.navigateByUrl('/login', skipLocationChange: true );


Navigates without pushing a new state into history.



https://angular.io/api/router/NavigationExtras






share|improve this answer























  • It works on browser but not when deployed to device. I wonder why.. I need it to work on devices though.

    – tyn
    Mar 10 at 17:59











  • Update: It actually works but not on root page. Let's say login page is my root page & I'm navigating from login page to home page, it wont work. Login page will still be in history.

    – tyn
    Mar 11 at 3:24













0












0








0







this.router.navigateByUrl('/login', skipLocationChange: true );


Navigates without pushing a new state into history.



https://angular.io/api/router/NavigationExtras






share|improve this answer













this.router.navigateByUrl('/login', skipLocationChange: true );


Navigates without pushing a new state into history.



https://angular.io/api/router/NavigationExtras







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 8 at 7:04









Jay OrdwayJay Ordway

7091326




7091326












  • It works on browser but not when deployed to device. I wonder why.. I need it to work on devices though.

    – tyn
    Mar 10 at 17:59











  • Update: It actually works but not on root page. Let's say login page is my root page & I'm navigating from login page to home page, it wont work. Login page will still be in history.

    – tyn
    Mar 11 at 3:24

















  • It works on browser but not when deployed to device. I wonder why.. I need it to work on devices though.

    – tyn
    Mar 10 at 17:59











  • Update: It actually works but not on root page. Let's say login page is my root page & I'm navigating from login page to home page, it wont work. Login page will still be in history.

    – tyn
    Mar 11 at 3:24
















It works on browser but not when deployed to device. I wonder why.. I need it to work on devices though.

– tyn
Mar 10 at 17:59





It works on browser but not when deployed to device. I wonder why.. I need it to work on devices though.

– tyn
Mar 10 at 17:59













Update: It actually works but not on root page. Let's say login page is my root page & I'm navigating from login page to home page, it wont work. Login page will still be in history.

– tyn
Mar 11 at 3:24





Update: It actually works but not on root page. Let's say login page is my root page & I'm navigating from login page to home page, it wont work. Login page will still be in history.

– tyn
Mar 11 at 3:24



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55057685%2fionic-4-angular-router-navigate-and-clear-stack-history-of-previous-page%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved