简体   繁体   中英

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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