Comments (5)
I've tested your scenario and everything seems OK at least for nativescript-geolocation
part. However @angular/http
module need some more configuration in order to work. I've just added a call to subscribe
method which triggers the http request.
UserService.prototype.getCityDetails = function () {
console.log('service call');
var listCities$;
this.http
.get("" + this.baseUrl, { headers: this.getHeaders() })
.map(mapPersons)
.catch(handleError)
.subscribe(function (r) {
console.log("subscribe called with " + r);
listCities$ = r;
});
console.dump(listCities$);
return listCities$;
};
Let me know how this works on your end.
from nativescript-geolocation.
Hi @nsndeck
Will try it and keep you posted!
Regards,
Madhu
from nativescript-geolocation.
@nsndeck I see data coming, but I can't return it back to the called function. I am using Typescript.
The outside console.dump(listCities$); before we return is still null.
var listCities$;
this.http
.get(`${this.baseUrl}`, {headers: this.getHeaders()})
.map(mapPersons)
.catch(handleError)
.subscribe((r) => {
listCities$ = r;
//I get values here
});
//Here listCities is null
console.dump(listCities$);
return listCities$;
from nativescript-geolocation.
getCityDetails() {
console.log('service call');
return Observable.create(observer => {
var listCities$;
this.http
.get(`${this.baseUrl}`, {headers: this.getHeaders()})
.map(mapPersons)
.catch(handleError)
.subscribe((r) => {
listCities$ = r;
observer.next(listCities$);
observer.complete();
});
});
}
This is for service
this.userservice.getCityDetails().subscribe((r) => {
console.log('after service call');
this.myItems = r;
console.dump(this.myItems[0]);
});
public myItems: RxObservable<Array<ListCities>>;
<ListView [items]="myItems" class="list-group">
<template let-item="item" let-i="index" let-odd="odd" let-even="even">
<GridLayout class="list-group-item" [class.odd]="odd" [class.even]="even">
<Label [text]="item.name" ></Label>
</GridLayout>
</template>
</ListView>
I can dump data, but not able to assign data to list view. Can you please help me here :)
from nativescript-geolocation.
ListView cannot work with RxObservable's directly. You should use async
pipe. Here is an example of using async pipe with nativescript-angular.
from nativescript-geolocation.
Related Issues (20)
- geolocation.clearWatch(watchId) iOS - is not able to stop watch geolocation
- LocationRequest() from plugin crash the app [BUG] HOT 5
- Distance function returns 0 between two locations HOT 4
- Sample Background Service for the Angular version HOT 4
- _getLocationCallback() from plugin crashes the app
- enableLocationRequest() not working on Android HOT 1
- Application crashes when using the plugin to get location geoLocation.isEnabled() HOT 3
- Cannot read property 'osVersion' of undefined at iOS HOT 4
- Google Play service fused location HOT 1
- getCurrentLocation takes 14 seconds to return the coordinates HOT 1
- App Crash after installing nativescript-plugin-firebase
- Android foregroundService location requests while screen is off for a while not working HOT 1
- watchLocation() HOT 4
- Nativescript 8 - TypeError: Cannot read property 'high' of undefined HOT 4
- Android 11 has new requirements regarding background location permissions HOT 1
- TypeError: Cannot read property 'Accuracy' of undefined. HOT 1
- [help wanted] exception handle...
- Nativesctipt geolocation cant resolve platform
- Detect Mock Location
- Plugin doesn't make my app build
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nativescript-geolocation.