chore: add loading controller
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
20fe50702b
commit
9137def36a
|
@ -1,5 +1,6 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import {TranslationService} from '../api/translation.service';
|
import {TranslationService} from '../api/translation.service';
|
||||||
|
import { LoadingController } from '@ionic/angular';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-tab1',
|
selector: 'app-tab1',
|
||||||
|
@ -10,7 +11,8 @@ export class Tab1Page {
|
||||||
|
|
||||||
myinput:String = ''
|
myinput:String = ''
|
||||||
myoutput: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)
|
if(this.myinput.length >= 2)
|
||||||
{
|
{
|
||||||
|
this.presentLoading();
|
||||||
this.translationService.getTranslation(this.myinput).subscribe( (data) =>
|
this.translationService.getTranslation(this.myinput).subscribe( (data) =>
|
||||||
{
|
{
|
||||||
this.myoutput = data['responseData']['translatedText'];
|
this.myoutput = data['responseData']['translatedText'];
|
||||||
|
this.loadingDialog.dismiss();
|
||||||
console.log(data);
|
console.log(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async presentLoading()
|
||||||
|
{
|
||||||
|
this.loadingDialog = await this.loadingController.create(
|
||||||
|
{
|
||||||
|
message: 'Translating ...',
|
||||||
|
});
|
||||||
|
await this.loadingDialog.present();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue