Ajout de la page listant les pièges
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
import { MatPaginator, MatTableDataSource } from "@angular/material";
|
||||
|
||||
import { ServiceApiGet } from "../../services/service-api-get.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
import { GearResp } from "../../models/gear";
|
||||
|
||||
@Component({
|
||||
selector: "app-list-of-gears",
|
||||
templateUrl: "./list-of-gears.component.html",
|
||||
styleUrls: ["./list-of-gears.component.css"]
|
||||
})
|
||||
export class ListOfGearsComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = [
|
||||
"id",
|
||||
"name",
|
||||
"latitude",
|
||||
"longitude",
|
||||
"address",
|
||||
"email",
|
||||
"type"
|
||||
];
|
||||
public dataSourceTable;
|
||||
public resultsLength = 0;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
constructor(
|
||||
private serviceApi: ServiceApiGet,
|
||||
private serviceComm: ServiceComm
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.updatedComponentTitle("List of gears");
|
||||
this.getListOfGears();
|
||||
}
|
||||
|
||||
getListOfGears() {
|
||||
this.serviceApi.getListOfGears().subscribe(data => {
|
||||
this.dataSourceTable = new MatTableDataSource<GearResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
this.resultsLength = data.length;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user