Last active
December 28, 2019 18:43
-
-
Save Ze1598/6ebd11df2eef2bfbdb9f64c19991636c to your computer and use it in GitHub Desktop.
Reusable modal component: modal-actions.service.ts (first version)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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