Ajout de la page listant les pièges

This commit is contained in:
Sébastien André
2019-11-23 16:48:52 +01:00
parent b9a29bcd79
commit 3f7966091c
17 changed files with 310 additions and 174 deletions

View File

@@ -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;
});
}
}