mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 10:41:13 +08:00
docs(loading): update example to show proper usage
docs(loading): update example to show proper usage
This commit is contained in:
@ -10,7 +10,7 @@ Loading indicators can be created using a [Loading Controller](../loading-contro
|
|||||||
|
|
||||||
### Dismissing
|
### Dismissing
|
||||||
|
|
||||||
The loading indicator can be dismissed automatically after a specific amount of time by passing the number of milliseconds to display it in the `duration` of the loading options. To dismiss the loading indicator after creation, call the `dismiss()` method on the loading instance. The `ionLoadingDidDismiss` event can be listened to in order to perform an action after the loading indicator is dismissed.
|
The loading indicator can be dismissed automatically after a specific amount of time by passing the number of milliseconds to display it in the `duration` of the loading options. To dismiss the loading indicator after creation, call the `dismiss()` method on the loading instance. The `onDidDismiss` function can be called to perform an action after the loading indicator is dismissed.
|
||||||
|
|
||||||
|
|
||||||
<!-- Auto Generated Below -->
|
<!-- Auto Generated Below -->
|
||||||
@ -21,7 +21,7 @@ The loading indicator can be dismissed automatically after a specific amount of
|
|||||||
### Angular
|
### Angular
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { Component, HostListener } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { LoadingController } from '@ionic/angular';
|
import { LoadingController } from '@ionic/angular';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -37,7 +37,11 @@ export class LoadingExample {
|
|||||||
message: 'Hellooo',
|
message: 'Hellooo',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
return await loading.present();
|
await loading.present();
|
||||||
|
|
||||||
|
const { role, data } = await loading.onDidDismiss();
|
||||||
|
|
||||||
|
console.log('Loading dismissed!');
|
||||||
}
|
}
|
||||||
|
|
||||||
async presentLoadingWithOptions() {
|
async presentLoadingWithOptions() {
|
||||||
@ -50,11 +54,6 @@ export class LoadingExample {
|
|||||||
});
|
});
|
||||||
return await loading.present();
|
return await loading.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('document:ionLoadingDidDismiss', ['$event'])
|
|
||||||
onDidDismiss(event: CustomEvent) {
|
|
||||||
console.log('Loading dismissed!');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -71,11 +70,11 @@ async function presentLoading() {
|
|||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
|
|
||||||
loading.addEventListener('ionLoadingDidDismiss', (e) => {
|
await loading.present();
|
||||||
console.log('Loading dismissed!');
|
|
||||||
});
|
const { role, data } = await loading.onDidDismiss();
|
||||||
|
|
||||||
return await loading.present();
|
console.log('Loading dismissed!');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function presentLoadingWithOptions() {
|
async function presentLoadingWithOptions() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
```typescript
|
```typescript
|
||||||
import { Component, HostListener } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { LoadingController } from '@ionic/angular';
|
import { LoadingController } from '@ionic/angular';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -15,7 +15,11 @@ export class LoadingExample {
|
|||||||
message: 'Hellooo',
|
message: 'Hellooo',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
return await loading.present();
|
await loading.present();
|
||||||
|
|
||||||
|
const { role, data } = await loading.onDidDismiss();
|
||||||
|
|
||||||
|
console.log('Loading dismissed!');
|
||||||
}
|
}
|
||||||
|
|
||||||
async presentLoadingWithOptions() {
|
async presentLoadingWithOptions() {
|
||||||
@ -28,10 +32,5 @@ export class LoadingExample {
|
|||||||
});
|
});
|
||||||
return await loading.present();
|
return await loading.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('document:ionLoadingDidDismiss', ['$event'])
|
|
||||||
onDidDismiss(event: CustomEvent) {
|
|
||||||
console.log('Loading dismissed!');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -8,11 +8,11 @@ async function presentLoading() {
|
|||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
|
|
||||||
loading.addEventListener('ionLoadingDidDismiss', (e) => {
|
await loading.present();
|
||||||
console.log('Loading dismissed!');
|
|
||||||
});
|
const { role, data } = await loading.onDidDismiss();
|
||||||
|
|
||||||
return await loading.present();
|
console.log('Loading dismissed!');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function presentLoadingWithOptions() {
|
async function presentLoadingWithOptions() {
|
||||||
|
Reference in New Issue
Block a user