Skip to content

Instantly share code, notes, and snippets.

@Ze1598
Last active December 28, 2019 18:43
Show Gist options
  • Save Ze1598/6ebd11df2eef2bfbdb9f64c19991636c to your computer and use it in GitHub Desktop.
Save Ze1598/6ebd11df2eef2bfbdb9f64c19991636c to your computer and use it in GitHub Desktop.
Reusable modal component: modal-actions.service.ts (first version)
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ModalActionsService {
constructor() { }
modalAction(modalData: any) {
switch (modalData.name) {
case "logout":
this.logout(modalData);
break;
case "deleteProduct":
this.deleteProduct(modalData);
break;
default:
break;
}
}
private logout(modalData: any) {
console.log("I came from a logout modal");
}
private deleteProduct(modalData: any) {
console.log("I came from a product deletion modal");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment