Skip to content

Commit 3eef605

Browse files
committed
fix issue #16
fix issue #16
1 parent ffdb18c commit 3eef605

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

angular-slimscroll.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ angular.module('ui.slimscroll', []).directive('slimscroll', function () {
77
var off = [];
88
var option = {};
99

10-
var refresh = function () {
10+
var init = function () {
1111
if ($attr.slimscroll) {
1212
option = $scope.$eval($attr.slimscroll);
1313
} else if ($attr.slimscrollOption) {
1414
option = $scope.$eval($attr.slimscrollOption);
1515
}
16+
1617
$($elem).slimScroll({ destroy: true });
18+
1719
$($elem).slimScroll(option);
18-
};
19-
20-
var init = function () {
21-
refresh();
2220

2321
if ($attr.slimscroll && !option.noWatch) {
2422
off.push($scope.$watchCollection($attr.slimscroll, refresh));
@@ -42,6 +40,7 @@ angular.module('ui.slimscroll', []).directive('slimscroll', function () {
4240
};
4341

4442
off.push($scope.$on('$destroy', destructor));
43+
4544
init();
4645
}
4746
};

0 commit comments

Comments
 (0)