So i loaded the json and now i cant display it and it says not well-formed. But i'm not really sure what to write in html.
here is my js:
app.controller('jsonController', function($scope, $http) {
$http.get('podaci.json').success(function(data) {
$scope.gradovi = data;
});
});
and html:
<div ng-controller = "jsonController">
<ol>
<li ng-repeat="gradovi in ponudjene">
{{gradovi.ponudjene}}
</li>
</ol>
</div>
and this is json:
{
"ponudjene": [
"Ada",
"Adaševci",
"Žitni Potok",
"Žitorađa",
"Zlatibor",
"Zlatica",
"Zlodol",
"Zlot",
"Zmajevo",
"Zminjak",
"Zrenjanin",
"Zubin Potok",
"Žuč",
"Zuce",
"Zvečan",
"Zvezdan",
"Zvonce",
"Đala",
"Đunis",
"Đurđevo",
"Đurđin"
],
"tacno": [
"Zvezdan",
"Zvezdan",
"Bor",
"Rudna Glava",
"Majdanpek"
],
"vreme": 100,
"oblast": "Istocna srbija"
}
Try like this
<ol>
<li ng-repeat="item in gradovi.ponudjene">
{{item}}
</li>
<li ng-repeat="item in gradovi.tacno">
{{item}}
</li>
<li>
{{gradovi.vreme}}
</li>
<li>
{{gradovi.oblast}}
</li>
</ol>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With