ionic-frameworkionic-viewionic2

force view to reload in ionic2 framework


After going through Clear History and Reload Page on Login/Logout Using Ionic Framework

I want to know same question, but for ionic2 using typescript.

On login and logout I need reload the app.ts, because there are classes that run libraries on construct.

it would be basically redirect to home and reload.


Solution

  • Ionic 1


    I haven't used Ionic 2 but currently i m using Ionic 1.2 and if they are still using ui-router than you can use reload: true in ui-sref

    or you can add below code to your logout controller

    $state.transitionTo($state.current, $stateParams, {
        reload: true,
        inherit: false,
        notify: true
    });
    

    Angular 2


    Use

    $window.location.reload();

    or

    location.reload();