I have this function in my angular controller:
$scope.get_all_places = function () {
$http.get("get-all-places").then(function (response) {
$scope.selected_place = eval(response.data[0]);
});
};
and i want to set the values i get from $scope.selected_place to this JavaScript code :
var $shape_options = selected_place.shape_attributes;
var $map_options = selected_place.map_attributes;
switch ($shape_options.shape_type) {
case 'circle':
var $center = selected_place.center;
var $radius = selected_place.radius;
break;
case 'rectangle':
var $bounds = selected_place.rectangle;
break;
case 'polygon':
var $path = selected_place.polygon;
break;
}
but the problem that the JavaScript code executed before the angular get the data from the server.
Any ideas how to do it?