chore: add loading controller
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2020-11-10 18:02:44 +01:00
parent 20fe50702b
commit 9137def36a
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -1,5 +1,6 @@
import { Component } from '@angular/core';
import {TranslationService} from '../api/translation.service';
import { LoadingController } from '@ionic/angular';
@Component({
selector: 'app-tab1',
@ -10,7 +11,8 @@ export class Tab1Page {
myinput:String = ''
myoutput:String = ''
constructor(private translationService: TranslationService)
loadingDialog: any;
constructor(private translationService: TranslationService, public loadingController: LoadingController)
{
}
@ -19,11 +21,22 @@ export class Tab1Page {
{
if(this.myinput.length >= 2)
{
this.presentLoading();
this.translationService.getTranslation(this.myinput).subscribe( (data) =>
{
this.myoutput = data['responseData']['translatedText'];
this.loadingDialog.dismiss();
console.log(data);
});
}
}
async presentLoading()
{
this.loadingDialog = await this.loadingController.create(
{
message: 'Translating ...',
});
await this.loadingDialog.present();
}
}