lib/common/src/modals-provider/base-toast-controller.service.ts
Methods |
Public Async failure | ||||||
failure(message: string)
|
||||||
Parameters :
Returns :
Promise<>
|
Public Async info | ||||||
info(message: string)
|
||||||
Parameters :
Returns :
Promise<>
|
Public Async present | ||||||
present(config: ToastConfig)
|
||||||
Parameters :
Returns :
Promise<>
|
Public Async success | ||||||
success(message: string)
|
||||||
Parameters :
Returns :
Promise<>
|
import { Injectable } from '@angular/core'
export interface ToastConfig {
message : string
color? : string //primary, secondary, tertiary, light, medium, dark, success, warning, danger
}
@Injectable()
export class RccToastController {
public async present( config: ToastConfig): Promise<unknown> {
const msg = "ModalProviderModule: missing ToastProvider, please provide alternative toastControllerClass extending RccToastController."
console.warn(msg)
throw msg
}
public async success (message: string): Promise<unknown>{
return await this.present({message: message, color: 'success'})
}
public async failure (message: string): Promise<unknown>{
return await this.present({message: message, color: 'warning'})
}
public async info (message: string): Promise<unknown>{
return await this.present({message: message, color: 'info'})
}
}