我有這樣的代碼:我如何發送像restangular post參數列表?
postAssignUserToProject(pid: number, selectedUsers: any, uid: number) {
var me = this;
return me.Restangular.all("configure/assign").one(pid.toString()).one(uid.toString()).post(selectedUsers);
}
我有這樣的代碼:我如何發送像restangular post參數列表?
postAssignUserToProject(pid: number, selectedUsers: any, uid: number) {
var me = this;
return me.Restangular.all("configure/assign").one(pid.toString()).one(uid.toString()).post(selectedUsers);
}
你應該把它們放到一個對象,並使用Restangular
obj = {
pid: pid.toString()
selectedUsers: selectedUsers
uid: uid.toString()
}
Restangular.one(url).post(obj).then(function(res){
// do something
})
或
Restangular.one(url).post({
pid: pid.toString()
selectedUsers: selectedUsers
uid: uid.toString()
}).then(function(res){
// do something
})
此代碼不becouse我的反手服務工作不recerve這種格式。 例如,y反手代碼是:
[HttpPost] [Route(「assign/{pid}/{changedBy}」)] public HttpResponseMessage AssignUserToProject(int pid,List
selectedUsers:是一個id列表...並且不工作。我想念什麼? – Stefnaister90