Skip to content

Files

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Latest commit

1fb1df9 · Dec 27, 2024

History

History
24 lines (21 loc) · 603 Bytes
·

example_component_ts.md

File metadata and controls

24 lines (21 loc) · 603 Bytes
·
import { Component } from '@angular/core';
import { IonButton, ToastController } from '@ionic/angular/standalone';

@Component({
  selector: 'app-example',
  templateUrl: 'example.component.html',
  styleUrls: ['example.component.css'],
  imports: [IonButton],
})
export class ExampleComponent {
  constructor(private toastController: ToastController) {}

  async presentToast(position: 'top' | 'middle' | 'bottom') {
    const toast = await this.toastController.create({
      message: 'Hello World!',
      duration: 1500,
      position: position,
    });

    await toast.present();
  }
}