hi i want to access my json data file in my angular app inside an app in grails. i dont find any way to address the json file clientside. in the tutorial the databinding is only cocered for json data so this is crucial for me.
function ShitCtrl($scope, $http) {
$http.get('http://localhost:8080/webapp/clients.json').success(function(data) {
$scope.shits = data;
});
}
function ShitDetailCtrl($scope, $routeParams) {
$scope.shitId = $routeParams.shitId;
}
this reports an 404 error. how can i solve this issue? when i address it in urlMappings this does not work then the mappings are absolute.
the point is: grails maps everything based on urlMappings, so it is not possible to address a file directly from js.
config . groovy:
grails.resources.adhoc.patterns = [
'/images/*',
'/css/*',
'/js/*',
'/plugins/*',
**'/staticData/*',**
'/assets/*'
so this then works like a charm:
function ShitCtrl($scope, $http) {
$http.get('../static/staticData/clients.json').success(function(data) {
$scope.shits = data;
});
}