Stefnaister90 Stefnaister90 - 2 months ago 20
TypeScript Question

How i send list like parameter with restangular post?

I have this code:

postAssignUserToProject(pid: number, selectedUsers: any, uid: number) {
var me = this;
return me.Restangular.all("configure/assign").one(pid.toString()).one(uid.toString()).post(selectedUsers);
}

Answer

you should put them into an object,and use Restangular

obj = {
 pid: pid.toString()
 selectedUsers: selectedUsers
 uid: uid.toString()
}
Restangular.one(url).post(obj).then(function(res){
  // do something
})

or

Restangular.one(url).post({
  pid: pid.toString()
  selectedUsers: selectedUsers
  uid: uid.toString()
}).then(function(res){
  // do something
})