数据点击之后,在表格里面实时更新

This commit is contained in:
luchenqun 2017-03-21 17:15:00 +08:00
parent b3a908e0fa
commit a7b8d9d31d
2 changed files with 16 additions and 1 deletions

View File

@ -55,13 +55,27 @@ app.controller('bookmarksCtr', ['$scope', '$state', '$stateParams', '$filter', '
});
if ($scope.showStyle != 'navigate') {
$scope.bookmarkData.bookmarks.forEach(function(bookmark) {
var bookmarks = $scope.showStyle == 'table' ? $scope.bookmarkData.bookmarks : $scope.bookmarkData;
bookmarks.forEach(function(bookmark) {
if (bookmark.id == id) {
bookmark.click_count += 1;
bookmark.last_click = $filter("date")(new Date(), "yyyy-MM-dd HH:mm:ss");
}
})
}
if ($scope.showStyle == 'table') {
$scope.changeOrder($scope.order.indexOf(true));
}
if ($scope.showStyle == 'costomTag') {
$scope.costomTags.forEach((tag) => {
if (tag.clicked) {
$scope.updateCostomTagBookmarks(tag.index)
}
})
}
$timeout(function() {
timeagoInstance.cancel();
timeagoInstance.render(document.querySelectorAll('.need_to_be_rendered'), 'zh_CN');

View File

@ -128,6 +128,7 @@ app.controller('tagsCtr', ['$scope', '$filter', '$window', '$stateParams', '$tim
bookmark.last_click = $filter("date")(new Date(), "yyyy-MM-dd HH:mm:ss");
}
})
$scope.changeOrder($scope.order.indexOf(true));
$timeout(function() {
timeagoInstance.cancel();
timeagoInstance.render(document.querySelectorAll('.need_to_be_rendered'), 'zh_CN');