Skip to content

Instantly share code, notes, and snippets.

@navio
Last active August 22, 2018 15:30
Show Gist options
  • Save navio/7444587 to your computer and use it in GitHub Desktop.
Save navio/7444587 to your computer and use it in GitHub Desktop.
Angular Script to Query Domai.nr API
<!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>
$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