Is there way to access the scope from inside a foreach function in angular?
$scope.getPlowHistory = function() {
$scope.plowId = $stateParams.plowId;
SnowPlowService.getPlowHistory($scope.plowId).then(function(response) {
$scope.plow = response;
angular.forEach($scope.plow,function(value,index){
$scope.Lat = value.Latitude;
$scope.Lng = value.Longitude;
});
});
};
I would need $scope.Lat and $scope.Long to be usable in $scope.getPlowHistory() and not just inside the foreach loop.
Thanks!