简体   繁体   中英

How to retrieve objects from rest url with multiple parameters using angular

How can i create a factory that can retrieve data from /rest/company/:companyid/employee/:id

when i use this url in the factory I get an error: Unknown provider companyidProvider

Thank you,

Kyle

Service:

 app.factory('EmployeeByCompany', function ($resource,companyid) { return $resource('app/rest/company/:companyid/employee/:id', {}, { 'query': { method: 'GET', isArray: true}, 'get': { method: 'GET'} }); }); 

I'm guessing the error is from having the companyid as a parameter with $resource. What is the right way for a service to call this url?

如果您正在学习或入门,请尝试Restangular https://github.com/mgonto/restangular

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