![](/img/trans.png)
[英]How to display json values for each <div>s in html page using angularjs ng-repeat
[英]How to map the JSON response to Html page using ng-repeat
我正在尝试使用ng-repeat将JSON中接收的数据映射到我的html页面,但是不知何故它不会在前端产生数据。我的html代码如下:
ul ng-repeat="ScheduleData in viewScheduleData"<br/>
li{{ScheduleData.day}}<br/>
ul<br/>
li{{ScheduleData.time_start}}/li<br/>
li{{ScheduleData.time_end}}/li<br/>
/ul<br/>
/li <br/>
/ul<br/>
我的scheduleCtrl.js的代码如下:
Schedule.viewSchedule($scope.doctorprofile,function(data) {<br/>
console.log(JSON.stringify(data));<br/>
if (data.ResponseCode == 1) {<br/>
console.log("yes in");<br/>
$Scope.viewScheduleData = data.Result;<br/>
}});
我可以看到您的数据通过JSON字符串化
$ Scope需要更改为$ scope。 “ s”应该很小。 您需要像这样给出。viewScheduleData应该是一个数组。
<ul> ng-repeat="ScheduleData in viewScheduleData">
<li>{{ScheduleData.day}}</li>
<li>{{ScheduleData.time_start}}</li>
<li>{{ScheduleData.time_end}}</li>
</ul>
试试这些
Schedule.viewSchedule($scope.doctorprofile,function(data) {
if (data.ResponseCode == 1) {
$scope.viewScheduleData = data;
}});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.