import { Component } from '@angular/core' ; import { NavController , AlertController , MenuController , ToastController , PopoverController , ModalController } from '@ionic/angular' ; import { SearchFilterPage } from '../../pages/modal/search-filter/search-filter.page' ; import { ImagePage } from './../modal/image/image.page' ; import { NotificationsComponent } from './../../components/notifications/notifications.component' ; @ Component ( { selector : 'app-home-results' , templateUrl : './home-results.page.html' , styleUrls : [ './home-results.page.scss' ] } ) export class HomeResultsPage { searchKey = '' ; yourLocation = '123 Test Street' ; themeCover = 'assets/img/ionic4-Start-Theme-cover.jpg' ; constructor ( public navCtrl , public menuCtrl , public popoverCtrl , public alertCtrl , public modalCtrl , public toastCtrl ) { } ionViewWillEnter ( ) { this . menuCtrl . enable ( true ) ; } settings ( ) { this . navCtrl . navigateForward ( 'settings' ) ; } async alertLocation ( ) { const changeLocation = await this . alertCtrl . create ( { header : 'Change Location' , message : 'Type your Address.' , inputs : [ { name : 'location' , placeholder : 'Enter your new Location' , type : 'text' } , ] , buttons : [ { text : 'Cancel' , handler : data => { console . log ( 'Cancel clicked' ) ; } } , { text : 'Change' , handler : async ( data ) => { console . log ( 'Change clicked' , data ) ; this . yourLocation = data . location ; const toast = await this . toastCtrl . create ( { message : 'Location was change successfully' , duration : 3000 , position : 'top' , closeButtonText : 'OK' , showCloseButton : true } ) ; toast . present ( ) ; } } ] } ) ; changeLocation . present ( ) ; } async searchFilter ( ) { const modal = await this . modalCtrl . create ( { component : SearchFilterPage } ) ; return await modal . present ( ) ; } async presentImage ( image ) { const modal = await this . modalCtrl . create ( { component : ImagePage , componentProps : { value : image } } ) ; return await modal . present ( ) ; } async notifications ( ev ) { const popover = await this . popoverCtrl . create ( { component : NotificationsComponent , event : ev , animated : true , showBackdrop : true } ) ; return await popover . present ( ) ; } }