@app/_models#AlertType TypeScript Examples
The following examples show how to use
@app/_models#AlertType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: alert.component.ts From angular-10-registration-login-example with MIT License | 6 votes |
cssClass(alert: Alert) {
if (!alert) return;
const classes = ['alert', 'alert-dismissable', 'mt-4', 'container'];
const alertTypeClass = {
[AlertType.Success]: 'alert alert-success',
[AlertType.Error]: 'alert alert-danger',
[AlertType.Info]: 'alert alert-info',
[AlertType.Warning]: 'alert alert-warning'
}
classes.push(alertTypeClass[alert.type]);
if (alert.fade) {
classes.push('fade');
}
return classes.join(' ');
}
Example #2
Source File: alert.component.ts From angular-10-signup-verification-boilerplate with MIT License | 6 votes |
cssClasses(alert: Alert) {
if (!alert) return;
const classes = ['alert', 'alert-dismissable'];
const alertTypeClass = {
[AlertType.Success]: 'alert alert-success',
[AlertType.Error]: 'alert alert-danger',
[AlertType.Info]: 'alert alert-info',
[AlertType.Warning]: 'alert alert-warning'
}
classes.push(alertTypeClass[alert.type]);
if (alert.fade) {
classes.push('fade');
}
return classes.join(' ');
}
Example #3
Source File: alert.component.ts From angular-11-crud-example with MIT License | 6 votes |
cssClass(alert: Alert) {
if (alert?.type === undefined) return;
const classes = ['alert', 'alert-dismissable', 'mt-4', 'container'];
const alertTypeClass = {
[AlertType.Success]: 'alert-success',
[AlertType.Error]: 'alert-danger',
[AlertType.Info]: 'alert-info',
[AlertType.Warning]: 'alert-warning'
}
classes.push(alertTypeClass[alert.type]);
if (alert.fade) {
classes.push('fade');
}
return classes.join(' ');
}
Example #4
Source File: alert.service.ts From angular-master-details-crud-example with MIT License | 5 votes |
warn(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Warning, message }));
}
Example #5
Source File: alert.service.ts From angular-master-details-crud-example with MIT License | 5 votes |
info(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Info, message }));
}
Example #6
Source File: alert.service.ts From angular-master-details-crud-example with MIT License | 5 votes |
error(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Error, message }));
}
Example #7
Source File: alert.service.ts From angular-master-details-crud-example with MIT License | 5 votes |
// convenience methods
success(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Success, message }));
}
Example #8
Source File: alert.service.ts From angular-11-crud-example with MIT License | 5 votes |
// main alert method
alert(message: string, type: AlertType, options: Partial<Alert> = {}) {
const id = options.id || this.defaultId;
const alert = new Alert(id, type, message, options.autoClose, options.keepAfterRouteChange);
this.subject.next(alert);
}
Example #9
Source File: alert.service.ts From angular-11-crud-example with MIT License | 5 votes |
warn(message: string, options?: Partial<Alert>) {
this.alert(message, AlertType.Warning, options);
}
Example #10
Source File: alert.service.ts From angular-11-crud-example with MIT License | 5 votes |
info(message: string, options?: Partial<Alert>) {
this.alert(message, AlertType.Info, options);
}
Example #11
Source File: alert.service.ts From angular-11-crud-example with MIT License | 5 votes |
error(message: string, options?: Partial<Alert>) {
this.alert(message, AlertType.Error, options);
}
Example #12
Source File: alert.service.ts From angular-11-crud-example with MIT License | 5 votes |
// convenience methods
success(message: string, options?: Partial<Alert>) {
this.alert(message, AlertType.Success, options);
}
Example #13
Source File: alert.service.ts From angular-10-signup-verification-boilerplate with MIT License | 5 votes |
warn(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Warning, message }));
}
Example #14
Source File: alert.service.ts From angular-10-signup-verification-boilerplate with MIT License | 5 votes |
info(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Info, message }));
}
Example #15
Source File: alert.service.ts From angular-10-signup-verification-boilerplate with MIT License | 5 votes |
error(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Error, message }));
}
Example #16
Source File: alert.service.ts From angular-10-signup-verification-boilerplate with MIT License | 5 votes |
// convenience methods
success(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Success, message }));
}
Example #17
Source File: alert.service.ts From angular-10-registration-login-example with MIT License | 5 votes |
warn(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Warning, message }));
}
Example #18
Source File: alert.service.ts From angular-10-registration-login-example with MIT License | 5 votes |
info(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Info, message }));
}
Example #19
Source File: alert.service.ts From angular-10-registration-login-example with MIT License | 5 votes |
error(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Error, message }));
}
Example #20
Source File: alert.service.ts From angular-10-registration-login-example with MIT License | 5 votes |
// convenience methods
success(message: string, options?: any) {
this.alert(new Alert({ ...options, type: AlertType.Success, message }));
}