Hi,
I have a small problem with an Angular.js app.
I’m using a module (ngGeolocation) which fetches GeoIP data and provides the parts that I am interested in as $geolocation.position.coords.longitude & $geolocation.position.coords.latitude.
They works perfectly and display the latitude and longitude when called in angular expressions in the webpage (for testing purposes - {{ $geolocation.position.coords.longitude }} etc…)
However, I want to use the postcodes.io API to find a local postcode from this.
I can get the postcode from set latitude and longitude but, when I try to concatenate the real, current latitude and longitude it breaks angular.
This example with set latitude and longitude works:
$http.get(‘//api.postcodes.io/postcodes?limit=1&lon=-0.1276250&lat=51.5033630’)
This, however, does not:
$http.get(‘//api.postcodes.io/postcodes?limit=1&lon=’ + $geolocation.position.coords.longitude + ‘&lat=’ + $geolocation.position.coords.latitude);
I’m still pretty new to this so maybe I’m doing something stupid…
Thanks for reading