UNPKG

ngipstack

Version:

A set of AngularJS directives/helpers for using IpStack with AngularJS

1 lines 652 B
(function(root,factory){"function"==typeof define&&define.amd?define(["exports","angular"],factory):"object"==typeof exports?factory(exports,require("angular")):factory(root.ngIpStack={},root.angular)})(this,function(exports,angular){"use strict";var ipStackModule=angular.module("ipStack",[]);ipStackModule.factory("requester",["$http",function($http){var apiKey=null;return{getIp:function(){return $http.get("https://api.ipstack.com/check?access_key="+apiKey).then(function(result){return result}).catch(function(err){return err})},setApiKey:function(accessKey){apiKey=accessKey},getApiKey:function(){return apiKey}}}]),exports.ngIpStack="ipStack"});