Iremos incluir Pets informando Raça, Sexo, Peso, Vacinas Tomadas e idade, sendo Vacinas e Idade opcionais.
1. Criando componente de página
page-adoption.component.html
Copy < cat-toolbar [config] = "getToolbarInfo()" ></ cat-toolbar >
app/shared/services/adoption/adoption.service.ts
Copy import { Injectable } from '@angular/core' ;
import { CatServiceBase } from '@catrx/ui/common' ;
import { HttpClient } from '@angular/common/http' ;
import { CatDatatableDataHttpResponse } from '@catrx/ui/datatable' ;
import { Observable } from 'rxjs/internal/Observable' ;
@ Injectable ({ providedIn : 'root' })
export class AdoptionService extends CatServiceBase {
constructor (httpClient : HttpClient ) {
super (httpClient , 'adoption' , {
useMockup : true ,
});
}
getDatatable (filter : any ) : Observable < CatDatatableDataHttpResponse < any >> {
throw new Error ( 'Method not implemented.' );
}
}
page-adoption.component.ts
Copy import { AdoptionService } from './../../shared/services/adoption/adoption.service' ;
import { Component } from '@angular/core' ;
import { CatCRUDComponentBase } from '@catrx/ui/common' ;
import { CatDatatableService , DatatableConfig } from '@catrx/ui/datatable' ;
import { CatFormService } from '@catrx/ui/form' ;
@ Component ({
templateUrl : './page-adoption.component.html' ,
})
export class PageAdoptionComponent extends CatCRUDComponentBase {
listConfig : DatatableConfig < any >;
constructor (
formService : CatFormService ,
datatableService : CatDatatableService ,
protected override service : AdoptionService
) {
super (formService , datatableService , service);
}
export (filename : string ) : void {
throw new Error ( 'Method not implemented.' );
}
}
2. Criando módulo da página e seu arquivo de rotas
page-adoption.routing.module.ts
Copy import { Routes , RouterModule } from '@angular/router' ;
import { CatAuthGuard } from '@catrx/ui/core' ;
import { PageAdoptionComponent } from './page-adoption.component' ;
import { NgModule } from '@angular/core' ;
const routes : Routes = [
{path : '' , component : PageAdoptionComponent , canActivate : [CatAuthGuard]}
]
@ NgModule ({
imports : [ RouterModule .forChild (routes)] ,
exports : [RouterModule]
})
export class PageAdoptionRoutingModule {}
Copy import { CommonModule } from '@angular/common' ;
import { NgModule } from '@angular/core' ;
import { CatPrimaryButtonComponent } from '@catrx/ui/button/primary' ;
import { CatConfirmModule } from '@catrx/ui/confirm' ;
import { CatDatatableModule } from '@catrx/ui/datatable' ;
import { CatDialogModule } from '@catrx/ui/dialog' ;
import { CatFormModule } from '@catrx/ui/form' ;
import { CatIconButtonModule } from '@catrx/ui/icon-button' ;
import { CatToolbarModule } from '@catrx/ui/toolbar' ;
import { PageAdoptionComponent } from './page-adoption.component' ;
import { PageAdoptionRoutingModule } from './page-adoption.routing.module' ;
@ NgModule ({
declarations : [PageAdoptionComponent] ,
imports : [
CommonModule ,
CatToolbarModule ,
CatFormModule ,
CatDatatableModule ,
CatDialogModule ,
CatConfirmModule ,
CatIconButtonModule ,
CatPrimaryButtonComponent ,
PageAdoptionRoutingModule ,
] ,
})
export class PageAdoptionModule {}