ionic framework - android device - Observable map() not working -
at startpage.ts call metroservice's getresult function alert on chrome(i can alert sayng "s" , next well), not on android device..(only s alert..i cant' next alert) how can solve this?
startpage.ts
export class startpage { constructor(public navctrl: navcontroller, public navparams: navparams, public metro:metroservice) { metro.getresults("subway"); }
metroservice.ts
getresults(keyword:string):observable<any> { console.log("keyword 22233: "+keyword); alert("s"); return this.http.get('/assets/metro.json') .map( result => { alert(result.json().data); console.log(result.json().data.filter(item => item.station_nm.tolowercase().startswith(keyword.tolowercase()) )) return result.json().data .filter(item => item.station_nm.tolowercase().startswith(keyword.tolowercase()) ) });
replace /assets/metro.json
assets/metro.json
also add error handler , see if there error in http.
return this.http.get('/assets/metro.json') .map( result =>{ ... },err => {alert("error "+err.message);} );
Comments
Post a Comment