i have problem. can't ng-repeat show data in html side.
it's $http.get json obejct nested arrays.
html:
<head> <script data-require="angular.js@1.3.15" data-semver="1.3.15"src="https://code.angularjs.org/1.3.15/angular.js"></script> <link rel="stylesheet" href="style.css" /> <script src="script.js"></script> </head> <body ng-app="stdviewer" ng-controller="stdctrl"> <h1>hello plunker!</h1> <div ng-repeat="ikas_standarder in data"> {{ikas_standarder.version}} <div ng-repeat="standarder in ikas_standarder"> {{standarder.tema}} <b>jobs:</b><br/> </div> </div> </body> </html>
script
(function() { var stdctrl = function($scope, $http) { var onsucces = function(response) { $scope.data = response.data; }; var onerror = function(reason) { $scope.error = reason; }; $http.get("http://46.31.18.93/dataservice/ikas_standard/sygehuse? format=json").then(onsucces, onerror); $scope.data = ''; $scope.reposortorder = "-sektorid"; }; var app = angular.module("stdviewer", []); app.controller("stdctrl", ["$scope", "$http", stdctrl]); }());
i have pluncker set here :http://plnkr.co/edit/errr8sj5eg6p4dprujx3?p=preview
change ng-repeats to:
<div ng-repeat="ikas_standarder in data.ikas_standarder">...</div>
and
<div ng-repeat="standarder in ikas_standarder.standarder">...</div>
for first 1 als change onsuccess method to
$scope.data = response.data.ikas_standarder
Comments
Post a Comment