ANGULARJS get city from ip address angularjs - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Together We Can Simplify The World
Just a Web Code Solution

How to get city from ip address with angularjs ?


 3276

 ANGULARJS


3

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">

<script src="//code.angularjs.org/snapshot/angular.min.js "></script>

</head>

<body ng-app="getip">

<script>

function foo(data) {

angular.module('getip', [])
.controller('myip', ['$scope', function ($scope) {
$scope.city = data.city;
} ]);

}

</script>
<script src="https://geoip.nekudo.com/api?callback=foo "></script>

<div ng-controller="myip">

<span>{{city}}</span>

</div>

</body>
</html>


  
The power of the user (%)
3%

 ANGULARJS


6

the second way to obtain city with angularjs

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="//code.angularjs.org/snapshot/angular.min.js "></script>
</head>

<body ng-app="getip">

<script>
var app = angular.module('getip', []);
app.controller('myip', function($scope, $http) {
$http.get("https://ipinfo.io/").then(function (response) {
var ip = response.data.ip;

$http.get("http://freegeoip.net/json/" + ip).then(function (response1) {
$scope.ip = response1.data.city;
});

});
});
</script>

<div ng-controller="myip">
<span>{{ip}}</span>
</div>

</body>
</html>


  
The power of the user (%)
32%

 ANGULARJS


4

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="//code.angularjs.org/snapshot/angular.min.js "></script>
</head>

<body ng-app="getip">

<script>
var app = angular.module('getip', []);
app.controller('myip', function($scope, $http) {

$http.get("http://freegeoip.net/json/").then(function (response) {
$scope.city = response.data.city;
});

});
</script>

<div ng-controller="myip">
<span>{{city}}</span>
</div>

</body>
</html>


  
The power of the user (%)
3%



The most helpful ANGULARJS solutions

How to get client ip address using angularjs ?How to get client ip address using angularjs ?ANGULARJS

Click to see more ...

  8.2K     2.3K

How to get city from ip address with angularjs ?How to get city from ip address with angularjs ?ANGULARJS

Click to see more ...

  3.3K     1.3K

how to get client machine name and user name using angularjs ?how to get client machine name and user name using angularjs ?ANGULARJS

Click to see more ...

  2.9K     713

How to get local client ip address using angularjs ?How to get local client ip address using angularjs ?ANGULARJS

Click to see more ...

  1.9K     495

get client country using angularjs ?get client country using angularjs ?ANGULARJS

Click to see more ...

  1.3K     469

get region angularjsget region angularjsANGULARJS

Click to see more ...

  1K     409

How to get value from a href using angularjs ?How to get value from a href using angularjs ?ANGULARJS

Click to see more ...

  1K     366

how to fill a list from an another file in json format using angularjs ?how to fill a list from an another file in json format using angularjs ?ANGULARJS

Click to see more ...

  660     341

How to get keycode using angularjs ?How to get keycode using angularjs ?ANGULARJS

Click to see more ...

  536     150

get client time zone using angularjs get client time zone using angularjs ANGULARJS

Click to see more ...

  277     139