Is there a way to display alert messages on every page in an Angular2/Ionic2 application? I want to create a common service to achieve this. Can someone guide me on how to proceed?
I am currently implementing the showAlert() function separately in each '.ts' file as shown below.
import { AlertController } from 'ionic-angular';
export class MyPage {
constructor(public alertCtrl: AlertController) {
}
showAlert() {
let alert = this.alertCtrl.create({
title: 'New Friend!',
subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
buttons: ['OK']
});
alert.present();
}
}