page-alert.component.html
Copy < cat-toolbar [config] = "getToolbarInfo()" >
< nav buttons >
< cat-success-button class = "mr-8" (click) = "openAlert('success')" >Sucesso</ cat-success-button >
< cat-warning-button class = "mr-8" (click) = "openAlert('warning')" >Atenção</ cat-warning-button >
< cat-danger-button class = "mr-8" (click) = "openAlert('error')" >Error</ cat-danger-button >
< cat-info-button (click) = "openAlert('info')" >Informação</ cat-info-button >
</ nav >
</ cat-toolbar >
Copy import { Component } from '@angular/core' ;
import { CatAlertService , CatAlertType } from '@catrx/ui/alert' ;
import { CatComponentBase } from '@catrx/ui/common' ;
@ Component ({
templateUrl : './page-alert.component.html' ,
})
export class PageAlertComponent extends CatComponentBase {
constructor ( private alertService : CatAlertService ) {
super ();
}
openAlert (type : CatAlertType ) {
this . alertService .show ({
type ,
message : `Alerta de Tipo: <b> ${ type } </b>` ,
});
}
}
Copy import { NgModule } from '@angular/core' ;
import { CatAlertModule } from '@catrx/ui/alert' ;
import { CatSuccessButtonComponent } from '@catrx/ui/button/seccess' ;
import { CatWarningButtonComponent } from '@catrx/ui/button/warning' ;
import { CatDangerButtonComponent } from '@catrx/ui/button/danger' ;
import { CatInfoButtonComponent } from '@catrx/ui/button/info' ;
import { CatToolbarModule } from '@catrx/ui/toolbar' ;
import { PageAlertComponent } from './page-alert.component' ;
import { PageAlertRoutingModule } from './page-alert.routing.module' ;
@ NgModule ({
declarations : [PageAlertComponent] ,
imports : [
CatToolbarModule ,
CatSuccessButtonComponent ,
CatWarningButtonComponent ,
CatDangerButtonComponent ,
CatInfoButtonComponent ,
CatAlertModule ,
PageAlertRoutingModule ,
] ,
})
export class PageAlertModule {}