adding allert onSearch button, fix redirecting
This commit is contained in:
@@ -22,13 +22,11 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
public locationsPopup: Subject<Locations[]> = new Subject<Locations[]>()
|
||||
|
||||
subs: Subscription[] = []
|
||||
|
||||
|
||||
subs: Subscription[] = [];
|
||||
backgroundColor: string | undefined;
|
||||
qrCodeImage: string | undefined;
|
||||
locations: Locations[] = [];
|
||||
|
||||
allert: boolean = false;
|
||||
locationsFiltrati: Locations[] = [];
|
||||
luogoSelezionato: string = '';
|
||||
suggerimentoAttivo: boolean = false;
|
||||
@@ -51,8 +49,7 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
console.log(data[i])
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.allert = false;
|
||||
console.log("home init");
|
||||
this.subs.push(this.readjsonService.getLocation("Lugano").subscribe(val => console.log(val)))
|
||||
const text = 'https://aramisgrata.ch'; // sostituisci con la tua stringa
|
||||
@@ -174,8 +171,16 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
onSearch(): void {
|
||||
const nomeLocation = encodeURIComponent(this.luogoSelezionato);
|
||||
this.router.navigate(['/location', nomeLocation]);
|
||||
if (this.luogoSelezionato === '') {
|
||||
this.allert=true;
|
||||
setTimeout(() => {
|
||||
this.allert=false;
|
||||
}, 8000);
|
||||
return;
|
||||
}else{
|
||||
const nomeLocation = encodeURIComponent(this.luogoSelezionato);
|
||||
this.router.navigate(['/location', nomeLocation]);
|
||||
}
|
||||
}
|
||||
|
||||
protected readonly Event = Event;
|
||||
|
||||
Reference in New Issue
Block a user