I have implemented loading controller on my component which brings data from json api
, i wish to achieve the time calculated to bring the data on the page.
Please find the code i have implemented OnInit
of listproduct.ts
export class ListproductPage implements OnInit{
public list = [];
loading;chkfromservice;
constructor(private _listProduct : ListproductService,private _deleteProduct : DeleteProductService,
public navCtrl: NavController,public navParams: NavParams,public loadingCtrl: LoadingController) {
this.loading = this.loadingCtrl.create({
content: 'Please wait...'
});
}
ngOnInit() {
this.loading.present();
this._listProduct.listProduct().subscribe(data => {
this.list = data;
console.log(this._listProduct.checkfromservice);
this.chkfromservice = this._listProduct.checkfromservice;
console.log(data[0].NAME);
this.loading.dismiss();
});
}
Please note, i need to calculate the time.microseconds between
this.loading.present();
andthis.loading.dismiss();