특정 비 ID 필드를 검색하려고하면 비표준 where 절이 필요합니다. 내가 필요로하는 엔드 포인트는 다음과 같습니다 Angular ngResource를 사용하여 비표준 API에 문의하는 방법
http://127.0.0.1:4001/api/testusers/findOne?userName=Anton
그래서이 나에게 열 (사용자 이름) = '안톤'는 testusers 테이블의 첫 번째 레코드를 찾을 수 있습니다.내 표준 서비스는 다음과 같습니다
angular.
module('shared.testUser').
factory('TestUser', ['$resource',
function($resource) {
return $resource('http://127.0.0.1:4001/api/testusers/:id', {id:'@id'},//parameters
{
update: {
method: 'PUT' // To send the HTTP Put request when calling this custom update method.
}
});
}
]);
내 호출 기능은 다음과 같습니다
self.checkUsersEntryDirection = function(){ //NOT WORKING
self.testuser = TestUser.get({ username: 'anton' }, function() {
console.log(angular.toJson(self.testuser));
}); // get() returns a single entry
}
은 분명이 작동하지 않습니다 나는 표준 접근법을 사용할 수 없다. 아무도 이것이 어떻게 달성 될 수 있다고 생각할 수 있습니까?