Note that there are some explanatory texts on larger screens.

plurals
  1. POAngular 1.0.8 $resource with multiple optional get parameters
    primarykey
    data
    text
    <p>My Student ulr looks like this:</p> <pre><code>var Student = $resource('/app/student/:studentid:courseId', {studentid:'@id',courseId:'@cid'} ); </code></pre> <p>When I call it without parameters I would like the url be <code>/app/student/</code> (works)</p> <pre><code>var names=Student.query( function(){ deferred.resolve(names); } ); </code></pre> <p>When I call it with studentid I would like the url be <code>/app/student/?id=88</code> (works)</p> <pre><code> Student.get({"id":id}, function(data){ deferred.resolve(data); } ); </code></pre> <p>When I call with courseid only I would like the url be <code>/app/student/?courseid=99</code> (doesnt)</p> <pre><code> Student.query({courseId:cId}, function(data){ deferred.resolve(data); } ); </code></pre> <p>Instead I get: <code>/app/student/6682831673622528</code></p> <p>When I call with both student and course id I would like: <code>/app/student/?id=1&amp;courseid=2</code> Instead I get <code>/app/student/12</code></p> <p>Trying something like this for the url: <code>/app/student/:studentid&amp;:courseid</code> gives me <code>/app/student/1&amp;2</code></p> <p>Somehow, only giving studentid works but courseid or both doesn't work as I would want it. Not sure how I would expect it because there nothing in the documentation about multiple parameters as a query string (there is on extending the url with <code>/app/student/studentid/1/courseid/2</code> but since it's an xhr request I'd like to have it request <code>/app/student/</code> with the GET parameters appended as <code>?one=val&amp;two=val</code></p> <p>Is there a way to do this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload