1
버튼이 있고 일부 링크는 사용자 국가에 따라 달라집니다.어떻게 각도 j를 가진 링크를 변경 하시겠습니까? 내 페이지에
예를 들어, 내 요점을 이해하기 위해이 코드를 각도로 표시했습니다.
이 코드는 저에게 적합하지 않습니다.
내가 놓친 것이 있습니까? 당신이 URL을 변경하면
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="http://getbootstrap.com/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<link href="http://getbootstrap.com/examples/jumbotron-narrow/jumbotron-narrow.css" rel="stylesheet">
<script src="http://getbootstrap.com/assets/js/ie-emulation-modes-warning.js"></script>
<script>
var app = angular.module('gJson', []);
app.controller('gCtrl', function($scope, $http) {
$http.get("//freegeoip.net/json/?callback=myGeoIP")
.success(function myGeoIP(d) {
if (d.country_code === 'US' || d.country_code === 'CA') {
$scope.alertz = "This Offer Available in + d.country_code";
$scope.uslink = 'http://example.US';
}
else
{
$scope.alertz = "This Offer Not Available in + d.country_code";
$scope.uslink = "http://Example.net";
}
});
});
</script>
</head>
<body ng-app="gJson">
<div class="container" ng-controller="gCtrl">
<div class="jumbotron">
<p>{{alertz}}</p>
<a class="btn btn-lg btn-success" ng-href="{{uslink}}" onclick="window.open(this.href, '_self', 'location=yes', 'toolbar=yes');">
Enter
</a>
</div>
</div>
</body>
</html>