I am trying to print the data from a JSON file in html using AngularJS, running everything by XAMPP and in my htdocs / test folder has 3 files (index.html, main.js, test.json). The console does not show any errors, I even tried to debug by firefox, I put a breakpoint in $ http.get, but it never gets to that point. Follow the code JS:
var app = angular.module('myApp', []);
app.controller("myCtrl", function ($http, $scope) {
$http.get('teste.json').then(function (response) {
$scope.myData = response;
});
});
JSON:
[{"id":"1","name":"John"},
{"id":"2","name":"Paul"}] </br/>
HTML:
<ul>
<li ng-repeat="data in myData">
{{data.id}}
{{data.name}}
</li>
</ul>