在 Ionic3 中关闭 LoadingController
dismiss LoadingController in Ionic3
中找到了这段代码
如果我理解正确,它基本上会在收到电子邮件和密码时关闭加载微调器
但我不明白它是如何工作的,我想知道它是如何工作的。
我试图找到关于 LoadingController 的其他教程,但它们大多是基于计时器的,而 Ionic 文档也是基于计时器的,我不想要,因为加载并不总是相同的精确时间,例如 1000 毫秒。
constructor(public loadingController:LoadingController){...}
let loading = this.loadingController.create({content : "Logging in ,please wait..."});
loading.present();
this.auth.login('basic', {'email':this.email, 'password':this.password}).then(()=>{
loading.dismissAll();
});
我不明白什么是
...
auth.login('basic', {'email':this.email, 'password':this.password})
...
可以使用promise
实现
Reference https://basarat.gitbooks.io/typescript/docs/promise.html
Promise The Promise class is something that exists in many modern JavaScript engines and can be easily polyfilled. The main motivation
for promises is to bring synchronous style error handling to Async /
Callback style code.
this.Profile.registration().then((data) => {
console.log('data arrived the data', data);
//Dismisisng the loading
loading.dismiss();
}
如果我理解正确,它基本上会在收到电子邮件和密码时关闭加载微调器
但我不明白它是如何工作的,我想知道它是如何工作的。
我试图找到关于 LoadingController 的其他教程,但它们大多是基于计时器的,而 Ionic 文档也是基于计时器的,我不想要,因为加载并不总是相同的精确时间,例如 1000 毫秒。
constructor(public loadingController:LoadingController){...}
let loading = this.loadingController.create({content : "Logging in ,please wait..."});
loading.present();
this.auth.login('basic', {'email':this.email, 'password':this.password}).then(()=>{
loading.dismissAll();
});
我不明白什么是
...
auth.login('basic', {'email':this.email, 'password':this.password})
...
可以使用promise
实现Reference https://basarat.gitbooks.io/typescript/docs/promise.html
Promise The Promise class is something that exists in many modern JavaScript engines and can be easily polyfilled. The main motivation for promises is to bring synchronous style error handling to Async / Callback style code.
this.Profile.registration().then((data) => {
console.log('data arrived the data', data);
//Dismisisng the loading
loading.dismiss();
}