[英]Passing multiple parameters from controller to service angularjs
Hi I am trying to figure out how to pass multiple ids to the service from my controller. 嗨,我试图找出如何将多个ID从控制器传递给服务的方法。
In my controller I am calling the service with two parameters, t1 and t2 在我的控制器中,我使用两个参数t1和t2调用服务
projEstimatesRepository.updateEstimate.update({ id: t1 }, function(data) {
alert("Estimates have been added sucessfully");
});
In my factory I have 在我的工厂里
updateEstimate: $resource('/api/estimates/P_estimate/:id', {id:'@id'}, {update: {method: 'PUT'}})
It works fine. 工作正常。 Except I need to pass t1 and t2 from controller to the service.
除了我需要将t1和t2从控制器传递到服务。 Please let me know how to pass them Thanks
请让我知道如何通过他们谢谢
Just add it as you did with id
: 就像添加
id
一样添加它:
updateEstimate: $resource('/api/estimates/P_estimate/:id/:id2', {id:'@id', id2:'@id2'}, {update: {method: 'PUT'}})
and then call as: 然后调用为:
projEstimatesRepository.updateEstimate.update({ id: t1, id2: t2 })
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.