From e16f9183370823c64b546a82b707a15aa6a51a56 Mon Sep 17 00:00:00 2001 From: Austin Buddington Date: Wed, 12 Oct 2016 10:32:34 -0400 Subject: [PATCH] Add digest to queue, outside of current digest cycle. --- src/index.html | 2 +- src/modules/s-tables.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/index.html b/src/index.html index 484769e..a401658 100644 --- a/src/index.html +++ b/src/index.html @@ -34,7 +34,7 @@

An example with element directives.

- + diff --git a/src/modules/s-tables.js b/src/modules/s-tables.js index 77b639b..c9f9ec0 100644 --- a/src/modules/s-tables.js +++ b/src/modules/s-tables.js @@ -21,7 +21,7 @@ replace: true, transclude: true, template: '
', - controller: ['$scope', '$element', '$attrs', '$rootScope', function ($scope, $element, $attrs, $rootScope) { + controller: ['$scope', '$element', '$attrs', '$rootScope', '$timeout', function ($scope, $element, $attrs, $rootScope, $timeout) { var _this = this; _this.sModelList = $scope.sModelList; _this.onSortChange = $scope.onSortChange; @@ -56,7 +56,11 @@ } }); - return (_this.onSortChange || angular.noop)(field, _this.orderTranslations[reversed]); + (_this.onSortChange || angular.noop)(field, _this.orderTranslations[reversed]); + + $timeout(function () { + $scope.$digest(); + }); }; $scope.$watchCollection('sTableCtrl.columns', function(newState, oldState) {