Skip to content

Instantly share code, notes, and snippets.

@jayserdny
Created January 9, 2018 09:54
Show Gist options
  • Save jayserdny/22e409d29523cdb09ca98275fb9312da to your computer and use it in GitHub Desktop.
Save jayserdny/22e409d29523cdb09ca98275fb9312da to your computer and use it in GitHub Desktop.
Alerts.ts for steemit tutorial
import { Injectable } from '@angular/core';
import { AlertController, ToastController } from 'ionic-angular';
@Injectable()
export class AlertsProvider {
constructor(private alertCtrl: AlertController, public toastCtrl: ToastController) {}
/**
* Method to present alert with error or message
*
* @param {any} msg: alert
*/
public showAlert(msg): void {
const alert = this.alertCtrl.create({
buttons: ['OK'],
message: msg || msg.message,
title: 'Oops!'
});
alert.present();
}
/**
* Method to present toast with error or message
*
* @param {any} msg: alert
*/
public presentToast(msg: any): void {
let toast = this.toastCtrl.create({
message: msg,
duration: 4000
});
toast.present();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment