Is there any frontend application sample that consumes RESTful services of Spring-data-rest backend which is written with angularJS.
-
what are you looking for exactly? angularjs part or spring part of this application? – Poyraz Yilmaz Mar 09 '14 at 17:45
-
Yes I want the frontend part. – Atıfcan Ergin Mar 10 '14 at 17:56
-
so actually you are looking for Rest Api for angularjs which is independent from your backend? – Poyraz Yilmaz Mar 10 '14 at 17:59
-
yes that's exactly what I want. – Atıfcan Ergin Mar 10 '14 at 21:57
-
ok check my answer hope it could help – Poyraz Yilmaz Mar 10 '14 at 22:07
4 Answers
Here are some links to AngularJS apps consuming Spring RESTful services

- 980
- 1
- 10
- 24
-
Thanks MKM I will try the 1st link but the 2nd and the 3rd link that you have sent are not for spring data rest because spring data rest supports hal+json not json. – Atıfcan Ergin Mar 10 '14 at 17:59
My prefer for rest api for angularjs is RESTANGULAR module...
In the site you can see many examples that how they deal with Rest calls and really good documentation and good community as well...
In this example which is from spring example SPRING.IO they uses $http, but I should say that Restangular uses $http as well, so basically you can say that Restangular is extended version of $http...
and for the last you can look for $resource...
I will update my answer If I will find something new...

- 5,847
- 1
- 26
- 28
-
Ok I implemented this solution as a frontend project then I got the error of "Access-Control-Allow-Origin" even if I have added the code like: `$httpProvider.defaults.useXDomain = true; delete $httpProvider.defaults.headers.common['X-Requested-With'];` to the config – Atıfcan Ergin Mar 11 '14 at 14:07
-
I don't think this issue related with restangular, but if you can think so you can search their form to get a solution and if you can provide any code I would like to help as well... – Poyraz Yilmaz Mar 11 '14 at 14:21
-
Yeah I think It's because of the nodejs server. I have to configure it for the CORS. – Atıfcan Ergin Mar 11 '14 at 14:23
-
-
No I use netbeans' angular-seed template. It has got embedded nodejs server script. – Atıfcan Ergin Mar 11 '14 at 16:30
-
ok here creator of restngular made a plunker which is a good example what you are looking for... http://plnkr.co/edit/d6yDka?p=preview – Poyraz Yilmaz Mar 11 '14 at 17:09
-
1You need to configure spring to allow cross site requests see http://stackoverflow.com/questions/22846309/cors-filter-not-working-as-intended – Gorky Jun 25 '14 at 12:57
At the moment, I think that angular-hal
is the best library to consume Spring Data Rest
output and stay with its philosophy of discovering url through relations.
The home page: https://github.com/LuvDaSun/angular-hal
and some examples :

- 1,792
- 1
- 23
- 38
here has a nice lib spring-data-rest-js can help you. It's a easy to use and lightweight javascript lib can run in both node.js and browser. After use this lib you can manage entity like this way:
let springRest = require('spring-data-rest-js');
let Student = springRest.entity.extend('students');
let student = new Student();
student.set('name', 'Tom');
//create entity
student.save().then(()=> {
//update entity
student.set('name', 'Physics');
retuen student.save();
}).then(()=> {
//delete entity
retuen student.delete();
}).catch(err=> {
done(err);
})
base on fetch API and Promise,inspired by Parse. It can be work with lib like AngularJS React Vue...

- 141
- 2
- 6