我有Kendo UI ListView如下:
<div ng-controller="patientSearchCtrl">
<div kendo-list-view id="listView" k-data-source="source">
<div class="product" k-template>
<h3>{{ dataItem.First_Name }}</h3>
<p>{{ dataItem.Last_Name }}</p>
</div>
</div>
<div kendo-pager k-data-source="source"></div>
</div>
遵循AngularJS代码:
angular.module("alertApp", ["kendo.directives"])
.controller("patientSearchCtrl", function ($scope, $http) {
var product;
$http.get('http://localhost:1242/Api/PatientSearch?firstName=Bar&lastName=wells&pageIndex=0&pageSize=10&sortingOrder=FIRST_NAME').
success(function (info, status, headers, config) {
product = info[0]["Table"];
console.log(product);
}).
error(function (data, status, headers, config) {
console.log('Error: ' + data);
});
$scope.source = new kendo.data.DataSource({
data: product,
pageSize: 1
});
});
的console.log(产品);正在记录数据。在Chrome中,它看起来像:
[Object]
0: Object
DOB: "07-29-1969"
First_Name: "Barbara"
Last_Name: "Wells"
PatientKey: 3
RowIndex: 1
我在这里做错了什么?
答案 0 :(得分:0)
尝试更改
$scope.source = new kendo.data.DataSource({
data: product,
pageSize: 1
});
到
$scope.source = {
data: product,
pageSize: 1
};
或
$scope.source = product;
提供完整的选择。使用以下代码
<div kendo-list-view k-options="source "></div>
$scope.source = {
dataSource: products,
template: "<div>#:First_Name#</div>"
};