kyjan/angular-sails — pull request #13 by TheSharpieOne (2014-03-27 22:14:29+00:00)
Title: Feat(interceptors): Added interceptors

Added interceptors because I like this project.

Simple Usage (in `config`):
```javascript
$sailsProvider.interceptors.push(['$q', function ($q) {
return{
request: function (config) {
// ... stuff
return config || $q.when(config);
},
response: function (response) {
// ... stuff
return response || $q.when(response);
},
requestError: function (config) {
// ... stuff
return $q.reject(reason);
},
responseError: function (response) {
// ... stuff
return $q.reject(reason);
}
}
}]);
```
Have as many as you want, push more to the `$sailsProvider.interceptors` array.
Should support the same things as [$http interceptors](http://code.angularjs.org/1.2.15/docs/api/ng/service/$http#interceptors).

I only tested it for my use case :( Sorry no actual test scripts.