Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 742 Bytes

README.md

File metadata and controls

24 lines (16 loc) · 742 Bytes

SatefulResource (work in progress)

A small AngularJS Service to query an endpoint in a stateful way.

Usage

Lets say you want to build something like GitHub Issues using AngularJS...

var issues = new SatefulResource('/issues').query() // GET /issues
issues.models // bindable issues array

issues.query({state: 'closed'}) // GET /issues?state=closed
issues.models // issues with state 'closed'

issues.query({author: 'bughunter'}) // GET /issues?state=closed&author=bughunter
issues.models // issues with state 'closed' AND with 'bughunter' as author

issues.query({state: null}) // GET /issues?author=bughunter (notice that the "state" param was removed)
issues.models // issues with state 'closed'