viezel / napp.alloy.adapter.restapi

RestAPI Sync Adapter for Titanium Alloy Framework
197 stars 102 forks source link

Change the "URL" parameter dynamically by ID #50

Closed virtualrapha closed 2 years ago

virtualrapha commented 10 years ago

I have a web-service that gives me back some JSON, if I make the request with an ID in the URL: http://mywebservice.com/api/user/<id>. In the example here on GitHub, the "URL" field is set statically, but is there a way to set it dynamically with a given ID? I tried overriding the url property in extendModel as well as in extendCollection but the console says TypeError: undefined is not a function (evaluating 'model.url()')

viezel commented 9 years ago

you could just parse the url in the fetch call like this:

collection.fetch({
   url: "mynewurl.com"
});