json - Unable to get data -
hope well!
i starting out angularjs , having trouble $http usage. have been scouring last 4 hours or trying figure out without luck.
this code here:
<!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <title>whois test</title> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css"> <link rel="stylesheet" href="css/app.css"> <script src="bower_components/angular/angular.js"></script> </head> <body> <div class="container" ng-app="app"> <ul> <li ng-repeat="answer in answers"></li> {{answer}} </ul> <script> angular.module('app', []) .controller('controller', function($scope, $http){ $http.get('http://api.statdns.com/statdns.net/mx').success(function(data){ $scope.answer = data; }); }); </script> </div> </body> what need check url given , pull information "answer": section , display data. want able user input url parse such as.
$http.get('http://api.statdns.com/{{query}}/mx')
any me on right track extremely appreciated , helpful.
ng-repeat used iterate on javascript array. data @ http://api.statdns.com/statdns.net/mx doesn't seem array:
{ "question": [ {...} ], "answer": [ {...} ], "authority": [ {...} ], "additional": [ {...} ], } did mean iterate on answers? this:
<ul> <li ng-repeat="answer in answers.answer"> {{answer}} </li> </ul>
Comments
Post a Comment