https://github.com/creads/partners-sdk-angular
:couple: A simple AngularJS module for Creads Partners API.
https://github.com/creads/partners-sdk-angular
angular
Last synced: 6 months ago
JSON representation
:couple: A simple AngularJS module for Creads Partners API.
- Host: GitHub
- URL: https://github.com/creads/partners-sdk-angular
- Owner: creads
- License: mit
- Created: 2015-03-18T15:24:17.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-05-03T23:18:10.000Z (about 3 years ago)
- Last Synced: 2025-08-11T12:48:36.114Z (10 months ago)
- Topics: angular
- Language: JavaScript
- Homepage: https://creads.github.io/partners-doc/
- Size: 1.87 MB
- Stars: 2
- Watchers: 6
- Forks: 3
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Angular Partners API [](https://travis-ci.com/creads/partners-sdk-angular)
A simple AngularJS module for Creads Partners API.
## Installation
npm install @creads/partners-sdk-angular
> If you're using node5, install with `--ignore-scripts` argument
> to avoid a BC bug on postinstall with opencollective required by webpack-cli.
## Usage
Include the file in your application:
```js
require('@creads/partners-sdk-angular');
```
Then add the module to your application:
```js
var myapp = angular.module('myapp', ['partners.api']);
```
## Configuration
Configure the API provider for your application:
```js
myapp.config([
'apiProvider',
function(apiProvider) {
// configure the api provider
apiProvider
.setEndpoint('ENDPOINT_URL')
;
}
]);
```
(Optional) Configure the interceptor provider for your application:
```js
myapp.config([
'apiInterceptorProvider',
function(apiInterceptorProvider) {
// configure the interceptor provider
apiInterceptorProvider
// Optional
.setOnRequest(function(config) {
// Do what you want with the request config object
return config;
})
// Optional
// The error method provide $injector as first parameter
.setOnRequestError(function($injector, rejection) {
// Do what you want with the rejection
})
;
}
]);
```
> for more information about interceptor see [angular $http doc section interceptor](https://docs.angularjs.org/api/ng/service/$http)
## Building the distribution (/dist)
To build the distribution:
npm ci
npm run build
## Running the tests
To run all the tests:
npm test