A simple AngularJS module for Creads Partners API.
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.
Include the file in your application:
require('@creads/partners-sdk-angular');
Then add the module to your application:
var myapp = angular.module('myapp', ['partners.api']);
Configure the API provider for your application:
myapp.config([
'apiProvider',
function(apiProvider) {
// configure the api provider
apiProvider
.setEndpoint('ENDPOINT_URL')
;
}
]);
(Optional) Configure the interceptor provider for your application:
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
To build the distribution:
npm ci
npm run build
To run all the tests:
npm test