简体   繁体   English

在Angularjs中从工厂调用时传递多个参数

[英]Passing more than one parameter in making call from factory in Angularjs

Hi I have following factory 嗨,我有以下工厂

App.factory("myRepository", ['$resource', function($resource) {
    return {
        myRecord: $resource('api/inst/Getinst/:id,name', { last: '@id', name: '@name' }, { query: { method: 'GET' } })
    };
}]);

I am trying to pass two parameters named id and name url. 我试图传递两个名为id和name url的参数。 This is not working. 这不起作用。 Please let me know how to pass more than one parameters with the url. 请告诉我如何使用网址传递多个参数。 Thanks 谢谢

Try this: 尝试这个:

$resource('api/inst/Getinst/:id/:name', { last: '@id', name: '@name' }, { query: { method: 'GET' } })

There is a example on angular resource docs that should help 角度资源文档中有一个应该有用的示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM