I am trying to create a map with angular app of mine to show the coordinates on the map. These coordinates are obtained from my api and is displayed on a detailed page. But the HTML code is giving me error:
Uncaught Error: 10 $digest() iterations reached. Aborting!
HTML:
<input value="{{place.place.name}}">
<label>zoom</label>
<input type="number" ng-model="zoom"/>
<div id="map_canvas">
<google-map center="{latitude: place.place.lat,longitude: place.place.lng}" zoom="zoom" draggable="true" options="options">
<marker coords="{latitude: place.place.lat,longitude: place.place.lng}"></marker>
</google-map>
</div>
All of this code is showing the above error. How can I fix this? below is my javascript, overall I have a list of places, then a user clicks on the place and the details of the place. The page also allows user to add a category to the page. So here is the whole Controller linking to the page where this map is located.:
$http.get('http://94.125.132.253:8000/getuncategorisedplaces').success(function (data, status, headers) {
$scope.places = data;
console.log(data);
$scope.message = 'Uncategorised places';
})
$scope.id = $routeParams.id;
$scope.showplace = function(id) {
$http({method: 'GET', url: 'http://94.125.132.253:8000/getitemdata?ID=' + $scope.id}).
success(function(data, status, headers, config) {
$scope.place = data; //set view model
console.log(data);
console.log(id);
$scope.view = 'templates/detail.html';
})
.error(function(data, status, headers, config) {
$scope.place = data || "Request failed";
$scope.status = status;
$scope.view = 'templates/detail.html';
});
}
$scope.showplace();
$scope.map = function(){
$scope.zoom = 13;
}
$scope.map();
$scope.meta = function () {
$http.get('http://94.125.132.253:8000/getmetas').success(function (data, status, headers) {
$scope.metas = data;
console.log($scope.category);
console.log(data);
$scope.message = 'List of Uncategorised places';
})
}
$scope.meta();
$scope.meta1 = function (data, status, headers) {
var formdata = {
'cat': $scope.cat,
}
var inserturl = 'http://94.125.132.253:8000/getcategories?meta=' + formdata.cat;
return $http.get(inserturl).success(function (data, status, headers) {
$scope.categories = data;
console.log(formdata.cat);
console.log(data);
});
};
$scope.$watch('cat', function (newvalue) {
$scope.meta1();
});
$scope.meta2 = function (data, status, headers) {
var formdata = {
'category': $scope.category,
}
var inserturl = 'http://94.125.132.253:8000/getsubcategories?category=' + formdata.category;
return $http.get(inserturl).success(function (data, status, headers) {
$scope.subcategories = data;
console.log(formdata.sub);
console.log(data);
});
};
$scope.$watch('category', function (newvalue2) {
$scope.meta2();
});