Code Monkey home page Code Monkey logo

Comments (10)

 avatar commented on July 19, 2024

+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.

mgonto avatar mgonto commented on July 19, 2024

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.

 avatar commented on July 19, 2024

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.

mgonto avatar mgonto commented on July 19, 2024

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.

mgonto avatar mgonto commented on July 19, 2024

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.

jadrake75 avatar jadrake75 commented on July 19, 2024

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.

mgonto avatar mgonto commented on July 19, 2024

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.

mgonto avatar mgonto commented on July 19, 2024

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.

sarath2 avatar sarath2 commented on July 19, 2024

Thanks for your effort. We are waiting for it.

from restangular.

mgonto avatar mgonto commented on July 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.