Skip to content

Nucleus-Inc/ngIpStack

Repository files navigation

ngIpStack

Build Status js-standard-style npm

The unofficial IpStack SDK for AngularJS (AKA Angular 1)

Requirements

Installation

Add library

You can get it on npm.

$ npm install --save ngIpStack
<script type="text/javascript" src="/ngipstack/dist/ngIpStack.min.js"></script>

Add dependency

var app = angular.module('myModule', ['ipStack']);

Usage

Set your api key

app.controller('myController', ['$scope', 'requester',
    function myController($scope, requester) {

        requester.setApiKey('your-api-key-ip-stack');

        console.log(requester.getApiKey());

    }
]);

Get your IP Address

app.controller('myController', ['$scope', 'requester',
    function myController($scope, requester) {

        requester.setApiKey('your-api-key-ip-stack');

        requester.getIp().then(function(res){

          var myIpAddress = res.data.ip;

          console.log(myIpAddress);

        });

    }
]);

Build

$ yarn install
$ gulp build

Tests

$ gulp test