在控制器中更新数据源时有效。将数据源更新放入 $resource 时无效。
//Works
$scope.thingsOptions = {
dataSource: {
data: [0]
}
};
//Doesn't work
myService2.getAllItems().then(
function (data) {
$scope.items = data;
$scope.thingsOptions = {
dataSource: {
data: [data.found]
}
};
},
function (errorMessage) {
$scope.error = errorMessage;
});