Git Product home page Git Product logo

Comments (9)

barhaleacct avatar barhaleacct commented on June 18, 2024

If you need any more clarification let me know, as I'd also like to be able to submit a key with a query.
I.e a validation key that confirms an API request is from a trusted approved source.

from angular-osd-resource.

barhaleacct avatar barhaleacct commented on June 18, 2024

I suppose along with submitting serialised data I'm talking about having a different way of having

.add('Form', '/api/forms/:id')
So you can use as with multiple /:id/:id
add('Form', '/api/forms/:id/:id/param/:id')

Using either or on the fly

from angular-osd-resource.

damacisaac avatar damacisaac commented on June 18, 2024

Thank you for your comment! I'm happy to hear someone finds it useful. I'm going to answer quickly for now and take a closer look later.

For querying a route with multiple ids, you would have to give them different names:

.add('Form', '/api/forms/:form_id/:next_id/:document_id')

and then query with:

Form.query({ form_id: 1, next_id: 2, document_id: 3, query_param: 'test' });

from angular-osd-resource.

damacisaac avatar damacisaac commented on June 18, 2024

If I understand correctly, to send a serialized form you just need to pass it through in the save() function and it will end up in the request body:

var serializedForm = '...';
Form.save({ form: serializedForm }).then();

from angular-osd-resource.

barhaleacct avatar barhaleacct commented on June 18, 2024

Would having

.add('Form', '/api/forms/:form_id/:next_id/:document_id')

Mean that if using "Form" in the controller and I didn't always want to send multiple ID's
e.g.
I may want just a form so send

Form.query({ form_id: 1}).then();

or i may want a form and comments from a specific person only so might only want to send 2 ID's

Form.query({ form_id: 1,user_id: 2}).then();

Maybe now I have more time to explain myself!!

from angular-osd-resource.

barhaleacct avatar barhaleacct commented on June 18, 2024

Thank You on the serialzedForm aspect. Wasn't sure if it would sent it - should have just tested it to be honest! Better to ask though!

You really have something cool here, really does trump the whole resolve first aspect for me due to the whole relations saving you typing multiple queries.

from angular-osd-resource.

damacisaac avatar damacisaac commented on June 18, 2024

For sending a variable number of IDs, angular will automatically strip any trailing slashes in the route. This means that you can pass only form_id if you need to.

from angular-osd-resource.

barhaleacct avatar barhaleacct commented on June 18, 2024

Smashing.

And is there anyway to chose a way to adjust the post headers to.
headers : { 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8' }

from angular-osd-resource.

damacisaac avatar damacisaac commented on June 18, 2024

you'll have to create a custom method and specify the headers on it. see the usage section for $resource, under the action parameter:

https://docs.angularjs.org/api/ngResource/service/$resource

from angular-osd-resource.

Related Issues (1)

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.