ngipstack
Version:
A set of AngularJS directives/helpers for using IpStack with AngularJS
17 lines (16 loc) • 452 B
JavaScript
let NgIpStack = 'ipStack'
let ipStackModule = angular.module('ipStack',[])
ipStackModule.factory('requester', ['$http', ($http) => {
let apiKey = null
return {
getIp: () => {
return $http.get('http://api.ipstack.com/check?access_key='+apiKey).then((result) => { return result }).catch((err) => { return err })
},
setApiKey: (accessKey) => {
apiKey = accessKey
},
getApiKey: () => {
return apiKey
}
}
}])