@krishnabsr2 wrote:
in my ionic 3 app i am trying to post to a url and whenever i does this and run on device the screen is going blank and showing white screen.This issue is happening whenever i am doing http actions or sqlite native operations.
app.module.ts
import { BrowserModule } from ‘@angular/platform-browser’;
import { ErrorHandler, NgModule } from ‘@angular/core’;
import { IonicApp, IonicErrorHandler, IonicModule } from ‘ionic-angular’;
import { SplashScreen } from ‘@ionic-native/splash-screen’;
import { StatusBar } from ‘@ionic-native/status-bar’;
import { SQLite,SQLiteObject } from ‘@ionic-native/sqlite’;
import { MyApp } from ‘./app.component’;
import { HomePage } from ‘…/pages/home/home’;
import { Http } from ‘@angular/http’;@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
SQLite,
Http,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}home.ts
import { Component,OnInit } from ‘@angular/core’;
import { NavController,NavParams,MenuController,App,IonicPage } from ‘ionic-angular’;
import { SQLite,SQLiteObject } from ‘@ionic-native/sqlite’;
import { Slides } from ‘ionic-angular/components/slides/slides’;
import { Http } from ‘@angular/http’;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {
//data:any = {};constructor(public navCtrl: NavController, public navParams: NavParams,app: App, menu: MenuController,private sqlite : SQLite,private http : Http ) {
menu.enable(true);}
ngOnInit() : void {
this.doPOST();}
doPOST() {
console.log(“POST”);
let url =http://services.notnul.com/NoteService.svc/GetHomePageMagazineData
;
this.http.post(url, {}).subscribe(res => console.log(res.json()));
}}
Posts: 1
Participants: 1