Added search button and onClick function to redirect to the location list

This commit is contained in:
grata
2023-04-14 21:12:17 +02:00
parent 3d0a96e7a7
commit 3bb31360d6
3 changed files with 36 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ import {distinctUntilChanged, fromEvent, Observable, Subject, Subscription} from
import {ReadjsonService} from "../service/readjson.service";
import {Locations} from "../interface/data";
import * as QRCode from 'qrcode';
import {Router} from "@angular/router";
interface Luogo {
location: string;
@@ -40,7 +41,7 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
img: any;
constructor(private readjsonService: ReadjsonService) {
constructor(private readjsonService: ReadjsonService, private router: Router) {
}
ngOnInit(): void {
@@ -172,9 +173,16 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
return null;
}
onSearch(): void {
const nomeLocation = encodeURIComponent(this.luogoSelezionato);
this.router.navigate(['/location', nomeLocation]);
}
protected readonly Event = Event;
}
function stringDifference(str1: string, str2: string): string {
let diff = '';
for (let i = 0; i < str2.length; i++) {