Added search button and onClick function to redirect to the location list
This commit is contained in:
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user