Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component } from '@angular/core';
- import { Platform, NavController } from 'ionic-angular';
- import { StatusBar } from '@ionic-native/status-bar';
- import { SplashScreen } from '@ionic-native/splash-screen';
- import { HomePage } from '../pages/home/home';
- import { LoginPage } from '../pages/login/login';
- @Component({
- templateUrl: 'app.html'
- })
- export class MyApp {
- rootPage: any;
- constructor(
- platform: Platform,
- statusBar: StatusBar,
- splashScreen: SplashScreen,
- ) {
- platform.ready().then(() => {
- // Okay, so the platform is ready and our plugins are available.
- // Here you can do any higher level native things you might need.
- statusBar.styleDefault();
- splashScreen.hide();
- });
- this.checkLogin();
- }
- checkLogin(){
- var a = window.localStorage.getItem("userName");
- if (!a){
- this.rootPage = LoginPage;
- }else{
- this.rootPage = HomePage;
- }
- }
- }
Add Comment
Please, Sign In to add comment