我控制器說:NG-重複無法檢索對象的數組數據
app.controller("PatientsController",function ($scope, $sce, $http,$window,$timeout){
var myScope = $scope;
myScope.PatientList = [];
myScope.getPatients = function() {
$http.get('http://my-ip/dashboard/patientlist').then(function(data){
myScope.PatientList = data.data;
console.log(myScope.PatientList);
});
};
myScope.getPatients();
});
的console.log有:
[{
"appointmentcount": "7",
"name": "A",
"phonenumber": "B",
"dateregistered": "2017-01-04 15:20:08"
}, {
"appointmentcount": "27",
"name": "C",
"phonenumber": "D",
"dateregistered": "2017-01-04 15:43:51"
}]
嘗試使用NG-重複是不會放棄任何輸出進行檢索:
<table class="table table-bordered table-condensed table-striped">
<div ng-repeat="pp in PatientList">
<tr>
<td>{{pp.name}} </td>
</tr>
</div> <!-- div ends -->
</table>
任何想法我錯過了什麼?
使用http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js
你有'NG-app'和'NG-controller'正確設置在HTML? – Sajal