0
我想通过角度读取json的值并在UI上显示数据。我无法这样做,因为我得到的UI格式不是数组。当我添加到控制台并查看格式时,它有点不同。我试图在控制台上玩“c”,无法玩这个物体。如何在我的网页上显示{{详情}}的任何提示?angularjs从服务中获取正确的格式数据
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope, $http, MyService) {
$scope.details = MyService.getDetails();
console.log($scope.details);
});
app.service('MyService', function ($http) {
this.getDetails = function (x, y) {
return $http.get("/Home/GetMyData")
.then(function (response) {
return response.data;
});
}
});
</script>
public JsonResult GetMyData()
{
var details = GetDet();
return Json(details, JsonRequestBehavior.AllowGet);
}
数组内名为“value”的对象内部是什么?属性?我的意思是,这些对象内的属性是什么? – lealceldeiro
是的,我需要数据内的价值 – Kurkula
你可以创建一个填充代码的小提琴吗? – Yaser