Closed rkmahale17 closed 7 years ago
I tired that solution but it's giving me error....
polyfills.js:3 Unhandled Promise rejection: Template parse errors: Can't bind to 'itemSelected' since it isn't a known property of 'ion-auto-complete'.
Please post your code
seat.js
import { Component, ViewChild, ElementRef } from '@angular/core'; import { NavController, Platform } from 'ionic-angular'; import { railwayService } from '../../services/rlwyServices'; import { autoForSeat } from '../../services/autoForSeat'; import {AutoCompleteComponent} from "ionic2-auto-complete/dist"; import { Geolocation } from '@ionic-native/geolocation'; import {trainStatus} from '../../pages/trainStatus/trainStatus';
declare var google;
@Component({ selector: 'seat', templateUrl: 'seat.html',
})
export class seat {
@ViewChild('map') mapElement: ElementRef;
map: any; searchVal: string; railValue:any; @ViewChild('searchbar') searchbar: AutoCompleteComponent; constructor(public navCtr:NavController , public rlwy: railwayService,public autoForSeat: autoForSeat, public geolocation: Geolocation ){
}
ionicViewData(){ this.searchVal =this.searchbar.getValue(); var numb = this.searchVal.match(/\d/g); var sham = numb.join(""); this.rlwy.getRoute(sham); //console.log(this.completeTestService.searchbar );
}
}
seat.html
<ion-auto-complete [dataProvider]="autoForSeat" [ionInput]="ionicViewData()" #searchbar >
what version of the plugin are you using?
@rkmahale17 I would first recommend you to upgrade the plugin (1.5.0-beta is available).
Secondly, I you should bind the event this way (I edited my previous post):
<ion-auto-complete (itemSelected)="doSomething($event)" ..... ></ion-auto-complete>
I by mistake confused between the two ways of binding ( it should be '()' and not '[]')
As described in the docs, you can bind the
itemSelected
event to the component. Example:<ion-auto-complete [itemSelected]="doSomething($event)" ..... ></ion-auto-complete>