Created
February 14, 2018 22:27
-
-
Save RhinoLance/6382a225282e9ae20d381114749fee2c to your computer and use it in GitHub Desktop.
Ionic not displaying page until window resize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import { Platform } from 'ionic-angular'; | |
import { StatusBar } from '@ionic-native/status-bar'; | |
import { SplashScreen } from '@ionic-native/splash-screen'; | |
import {Observable} from 'rxjs/Rx'; | |
import { Subject } from "rxjs/Rx"; | |
import { HomePage } from '../pages/home/home'; | |
@Component({ | |
templateUrl: 'app.html' | |
}) | |
export class MyApp { | |
rootPage:any; | |
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) { | |
platform.ready().then(() => { | |
let source = this.init(); | |
source.subscribe( | |
result => { | |
this.rootPage = HomePage; | |
}); | |
}); | |
} | |
private init() : Observable<any> { | |
let db = window["openDatabase"]( "test", "1.0", "bobo_test", 50 * 1024 * 1024); | |
let observable = new Subject(); | |
db.transaction( (transaction) => { | |
transaction.executeSql("SELECT count(*) FROM sqlite_master", [], | |
(tx, result ) => { | |
console.log( `db.query compelte: ${JSON.stringify(result)}`); | |
observable.next( result ); | |
observable.complete(); | |
}, | |
(tx, error) => { | |
console.error( "db.query error: " + JSON.stringify(tx) + "\n" + error.message ); | |
observable.error( error.message ); | |
observable.complete(); | |
} | |
); | |
}); | |
return observable; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment