Last active
August 22, 2018 15:30
-
-
Save navio/7444587 to your computer and use it in GitHub Desktop.
Angular Script to Query Domai.nr API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body ng-controller="domainSearcher"> | |
<input ng-model="search" ng-change="getDomains()" type="search" placeholder="Search Domain" /> | |
<input type="button" value="Go" ng-click="getDomains()" /> | |
<li ng-repeat="result in results"> | |
{{result.subdomain}}{{result.path}} | |
</li> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.information = ""; | |
function domainSearcher($scope, $http){ | |
$scope.getDomains = function(){ | |
var url = 'http://domai.nr/api/json/search?q='; | |
url = url + $scope.search+'&callback=JSON_CALLBACK'; | |
$http.jsonp(url).success(function(data) { | |
$scope.results = data.results; | |
}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment