busqueda.component.ts
694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
@Component({
selector: 'app-busqueda',
templateUrl: './busqueda.component.html',
styleUrls: ['./busqueda.component.css']
})
export class BusquedaComponent implements OnInit {
search : string;
order : string = "Asc";
results : any[];
constructor(private route : ActivatedRoute) { }
ngOnInit(): void {
this.route.paramMap.subscribe(
(params) => this.search = params.get('search')
);
this.results = [
"Cosa1",
"Cosa2",
"Cosa3",
"Cosa4",
"Cosa5",
"Cosa6",
"Cosa7"
]
}
change() {
this.order = (this.order == "Asc" ? "Des" : "Asc");
}
}