Guest User

Untitled

a guest
Jun 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. import { Component } from '@angular/core';
  2. import { Platform, NavController } from 'ionic-angular';
  3. import { StatusBar } from '@ionic-native/status-bar';
  4. import { SplashScreen } from '@ionic-native/splash-screen';
  5.  
  6. import { HomePage } from '../pages/home/home';
  7. import { LoginPage } from '../pages/login/login';
  8.  
  9. @Component({
  10. templateUrl: 'app.html'
  11. })
  12. export class MyApp {
  13.  
  14. rootPage: any;
  15.  
  16. constructor(
  17. platform: Platform,
  18. statusBar: StatusBar,
  19. splashScreen: SplashScreen,
  20. ) {
  21. platform.ready().then(() => {
  22. // Okay, so the platform is ready and our plugins are available.
  23. // Here you can do any higher level native things you might need.
  24. statusBar.styleDefault();
  25. splashScreen.hide();
  26. });
  27. this.checkLogin();
  28. }
  29. checkLogin(){
  30. var a = window.localStorage.getItem("userName");
  31.  
  32. if (!a){
  33. this.rootPage = LoginPage;
  34. }else{
  35. this.rootPage = HomePage;
  36. }
  37. }
  38. }
Add Comment
Please, Sign In to add comment