How to configure Id property of Restangular URL building
ajax, angularjs, httprequest, restangular
Solution
A better answer would be to set the id field of a particular service.
angular.module('app')
.service('SomeService', ['rootUrl', 'Restangular', function SomeService(rootUrl, Restangular) {
return Restangular.withConfig(function (config) {
config.setRestangularFields({"id": "username"});
}).all('cars');
}]);
Problem
Let, ``` Restangular.one('users').getList().then(function(users) { $scope.user = users[0]; }); ``` Another GET request: Let: `user: { id: '123' }` `$scope.cars = $scope.user.getList('cars');` This would fires a GET request: /users/123/cars where the 123 is gotten from the id property. Question: Is it possible to explicitely configure if my object's id property, for example: was named username. ``` user: { username: '123' } ```