I'm using **ng-map** (http://willleahy.info/ng-maps/#/) library in my
AngularJS web app in order to create a widget where to display Points of
Interests.
I have problem retrieving coordinates data from REST web service and
passing these coordinates to the controller of the Map widget.
This is the controller of this "Map Widget":
<!-- language: lang-js -->
drfmControllers.controller('M_02_02_controller', ['WidgetService', '$scope',
function (WidgetService, $scope) {
/********* This is the an attempt in order to read coordinates from REST
*********/
var poi = WidgetService.M_02_02_poi.query(
{
aggregator_id: "aggr_1"
});
console.log(poi);
/********************************* Attempt END
***********************************/
$scope.map = {
center: [41.807680, 12.337742],
options: function () {
return {
zoom: 15,
streetViewControl: false,
scrollwheel: false
}
}
};
$scope.points = {
/* These are the LOCALLY coordinates I want read from REST
service
coords: [
[41.807680, 12.337742],
[41.807560, 12.333901]
], */
coords: poi,
options: function (coords, properties, i, map) {
return {
draggable: true
}
},
events: {
click: function (e, point, map, points) {
alert(point)
}
},
decimals: 3
};
}]);
And this is the service in the factory:
<!-- language: lang-js -->
drfmApp.factory("WidgetService", ['$resource',
function ($resource) {
return {
M_02_02_poi:
$resource("http://localhost:8080/NobelGrid/api/widgets/M_02_02/poi",
{state: "open"},{query: {method: "GET",isArray: true}})
};
}]);
These is the response from the network log:
<https://lh3.googleusercontent.com/-HAS1fS3gIXw/V1fYRECyJcI/AAAAAAAAAes/Uc_rTGGXZPskIYvsg2WhLAdaRoHurfe2ACLcB/s1600/Schermata%2B2016-06-07%2Balle%2B15.38.09.png>
and the console output:
<https://lh3.googleusercontent.com/-gf1bRm6RmsY/V1fYW1m4uyI/AAAAAAAAAe0/QV1U1Az0Y3EeZRy1ium29qQpn-9B4aIdwCLcB/s1600/Schermata%2B2016-06-07%2Balle%2B15.40.21.png>
Any ideas?
If you need more details please write a comment.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.