Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setRestangularFields for nested Resource #585

Closed
mukgupta opened this issue Feb 21, 2014 · 2 comments
Closed

setRestangularFields for nested Resource #585

mukgupta opened this issue Feb 21, 2014 · 2 comments
Labels

Comments

@mukgupta
Copy link

I have a company resource whose ID field is cid which i access using

var companies = Restangular.withConfig(function(RestangularConfigurer){
            RestangularConfigurer.setRestangularFields({ id: "cid" });         
        }).all('companies');

Structure of my rest api to access companies list is /api/companies/

I retrieve the employee list using:

var employees  = companies.one("mycid").getList('employees').$object;

Route to access employees is /api/companies/CID/employees.

now the ID field for employee is 'eid' . How can i set the configuration for employees resources to use 'eid' as the ID field.

Currently when is do employees[0].remove() ,it sends a request to

/api/companies/CID/employees/CID.

Whereas the actual request must be sent to

 /api/companies/CID/employees/EID
@mukgupta
Copy link
Author

@mgonto : Martin , Can you please reply

@mgonto
Copy link
Owner

mgonto commented Feb 28, 2014

Hey,

You have several options to fix this issue.

Check #413 for all possibilities :).

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants