当第一次加载页面时,我得到填充了我的thingsList
。但后来我需要选择ng-click
选项,它会触发功能doSomething()
,它正在获得新的thingsList
。我可以在调试模式下看到有一个新列表,但没有绑定和数据表仍然显示旧的thingsList
。Angular Datatables ng-click没有约束力(角度方式)
我真的很想解决这个问题,没有dtOptions是可能的。
我使用的是非常简单的 “角办法” 与数据表:
<tr ng-repeat="thing in thingsList">
<td>{{thing.id}}</td>
<td>{{thing.name}}</td>
</tr>
和我的控制器看起来像:
.controller('ThingsController', ['$http', '$scope', function ($http, $scope) {
this.getThing = function() {
$http.get(....).then(
function success(response) {
$scope.thingsList = response.data;
},
function error(data) {
console.log(data);
}
);
};
this.getThings();
this.doSomething = function (id) {
$http.get(....).then(
function success(response) {
$scope.thingsList = response.data;
},
function error(data) {
console.log(data);
}
);
};
}]);
你能否提供一个好的plunkr – Prianca