busqueda.component.ts 694 Bytes
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");
	}
}