简体   繁体   中英

Redirecting from one angular app to another in ionic

I am currently converting an angularjs application into ionic, the angularjs project consists of two applications 1. Login app and 2. The actual app.

On running ionic serve, first the login app(localhost/login) is loaded, once the user has entered the credentials, the user is redirected to the actual application with a different url(localhost/app).

Is the same scenario possible in ionic and if it is, can anyone please tell how to achieve this?

You can achieve it by using $stateProvider and $urlRouterProvider

check this https://scotch.io/tutorials/angular-routing-using-ui-router tutorial

.config(function($stateProvider, $urlRouterProvider) {

    $urlRouterProvider.otherwise('/home');

    $stateProvider


        // HOME STATES AND NESTED VIEWS ========================================
        .state('home', {
            url: '/home',
            templateUrl: 'partial-home.html'
        })

        // ABOUT PAGE AND MULTIPLE NAMED VIEWS =================================
        .state('about', {
            // we'll get to this in a bit       
        });

});

https://www.thepolyglotdeveloper.com/2014/11/using-ui-router-navigate-ionicframework/

reefer this above tutorial

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM