Comments (10)
+1 I understand how it works but not how to setup a simple application with this.
Can you give an example with routing / controllers?
from restangular.
There's a simple example here http://plnkr.co/edit/Sh669ScCQRyD513bzsBx
I'm planning on doing a CRUD example (That's only get & nested resources) using apiary.io as soon as I get some time.
I also want to make some HTML page for this but my CSS abilities suck, so that I can make an example in the website and not in plunkr.
from restangular.
Thanks!
Why not use Twitter Bootstrap or Zurb Foundation to make a simple but easy to ready documentation guide?
You will only need to worry about content and not about styling.
from restangular.
Yeah, I know about Tw Bootstrap but it still requires some design.
I'll try to make it. Meanwhile, check that plunkr and let me know if that works out for you :).
from restangular.
Anyway,
setting up Restangular would look something like: https://github.com/mgonto/restangular#how-to-configure-them
And the code example in the README is real and it works https://github.com/mgonto/restangular#lets-code
In this last one, you can see how the routes should be for this to work.
They should use nested restful resources, similar to what Rails does with resource
command in Routes file
from restangular.
Thanks for a great tool. I am trying out restangular with my JAX-RS webservices. My responses from my webservices will have their data in an array named differently depending on the resource called. For example "/rest/countries" - the data is in {response}.countries. For "/rest/sellers" the data is in {response}.sellers.
If I set an interceptor on the app config this is global and does not provide the current resource (although I am not sure I can make a 1:1 connection between resource path and result data - or at least I'd rather not). Is there a way to set an interceptor on the instance injected into the service where restangular is used? I have tried setting it on Restangular and Restagular.all("countries") but both of these do not seem to provide access to the configuration methods such as setResponseInterceptor(). I am calling .getList( ) to get the items.
I guess what I am missing is how can I apply instance specific configurations beyond the global config?
I am using 0.6.5 and also tried 0.6.6
from restangular.
Hey,
You can actually do that with the responseInterceptor, using instances names.
Take a look at https://github.com/mgonto/restangular#responseinterceptor-or-responseextractor-its-an-alias You'll see that the response interceptor receives actually the model name as the third parameter (what).
So you could do something like follows:
RestangularProvider.setResponseExtractor(function(response, operation, what, url) {
var newResponse;
if (operation === "getList") {
// If what is countries, it'd be response.countries
newResponse = response[what];
} else {
newResponse = response;
}
return newResponse;
});
Hope this works out for you!!!
And also please, if you can next time create a separate issue with your questions. Thanks!!!
from restangular.
There's already a work in progress for this CRUD here:
https://github.com/mgonto/angularjs-talk
There you have some get() and getList() for the time being.
from restangular.
Thanks for your effort. We are waiting for it.
from restangular.
Hey guys,
I've implemented the same project as ANgular's javascript project but with Restangular.
I hope this suits you well :)
Check out http://plnkr.co/edit/bs5Qu8D6mYXzJXR74b87?p=preview
Bests,
Gonto
from restangular.
Related Issues (20)
- Error when injecting restangular with angular 1.6.4 HOT 2
- Nested Services or Nested Configuration
- $remove() id as query parameter HOT 1
- new web app using restangular - www.connecttal.com -
- Element.plain() behaves differently compared to Retangular.stripRestangular
- How to make sync call?
- How to set array of object as parameters using customGET ?
- Did restangular support handling text/html or text/csv response?
- Response for getList SHOULD be an array and not an object or something else HOT 1
- make etag a strong etag when used in if-None-Match HOT 1
- Cancel request - Angular 1.5 HOT 1
- getList() response Json object loss some data
- How do I append query parameter with restangular.oneUrl()? HOT 1
- Details of HTTP request sent by put method ?
- Group by count
- addFullRequestInterceptor has empty headers object
- TypeError: Converting circular structure to JSON while <restangular-object>.put() HOT 1
- Multiple remove on Restangular
- Deprecated?
- Support DELETE method with body
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restangular.