I have a resource Answerthat has a composite key of QuestionnaireIdand QuestionId. The ngResource code is as follows:
function answerResource($resource) {
return $resource("/api/answers/:questionnaireId/:questionId",
{
questionnaireId: "@questionnaireId",
questionId: "@questionId"
}
);
}
I want to request this resource with the questionnaire ID and return all the answers. If I use:
answerResource.query(
{
questionnaireId: questionnaireId
}
);
Then the requested URL:
/api/answers/123
When I want it to be:
/api/answers?questionnaireId=123
Otherwise, I have two routes that I need to process to search for the request: one with the identifier in the query string, the other with the identifier as part of the URL. (I also have queries with search text where the questionnaire identifier may be missing, which will use URLs such as /api/answers?q=sometext).
, .query , . ?