I am loading json data from server, but it’s take some time due to live server, so anyone tell how to use Loading.
let MyOutput = this.dataService.getProducts();
if(MyOutput)
{
MyOutput.map(res => res.json())
.subscribe(
results => {
console.log(results);
if(results.success)
{
this.products = results.products;
}
else if(results.message == 'invalid')
{
let alert = this.alertCtrl.create({
title: 'Opps!',
subTitle: results.description,
buttons: ['OK']
});
alert.present();
}
}, error => {
console.log(JSON.stringify(error.json()));
},
() => {
loading.dismiss();
});
}