Set id property when defining a route
See original GitHub issueIs it possible to set id property while defining a route? I know there is one global config, but each model I get from server has different property name for ID
Restangular.all('tenants');
// some way to set id value from 'tenantId' of the Tenant
Issue Analytics
- State:
- Created 10 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
How to pass id to React Js path link? - Stack Overflow
1 Answer 1 · Define your path to include an id <Route path="/products/:id"> <Products /> </Route> · On the products page use useParams...
Read more >Routing to controller actions in ASP.NET Core - Microsoft Learn
Attribute routing provides fine-grained control to make the ID required for some actions and not for others. By convention, the documentation ...
Read more >Manage Routes in a Route Set - Oracle Help Center
Search for Routes in a Route Set. You can search for routes in a route set by pub-id, SED, and other properties. You...
Read more >How to use attribute routing in ASP.NET Core - InfoWorld
You can set up routing in ASP.NET Core in two different ways: attribute-based routing and convention-based routing.
Read more >Defining Your Routes - Ember Guides
The default serialize method inserts the model's id into the route's dynamic segment (in this case, :post_id ). Initial routes. A few routes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You do have one more option.
In the new version, I actually expose the configuration so you could replace the function
setIdToElem
andgetIdFromElem
fromRestangular.configuration
orRestangularProvider.configuration
.setIdToElem: https://github.com/mgonto/restangular/blob/master/src/restangular.js#L197
getIdToElem: https://github.com/mgonto/restangular/blob/master/src/restangular.js#L202
Basically, what you could do is something like
If this is known not to work with RestangularProvider (as seems to be the case in my experience), then the README is a bit misleading: https://github.com/mgonto/restangular#what-if-each-of-my-models-has-a-different-id-name-like-customerid-for-customer