Skip to content

Commit 232c2af

Browse files
author
Null McNull
committed
Fix: Initial location change ignored
1 parent d69c65b commit 232c2af

File tree

4 files changed

+15
-129
lines changed

4 files changed

+15
-129
lines changed

package/angular-block-ui/README.md

Lines changed: 0 additions & 116 deletions
This file was deleted.

package/angular-block-ui/angular-block-ui.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,13 @@
115115
link: function($scope, $element, $attrs) {
116116
$scope.state = blockUI.state();
117117

118-
var i = 0; // Skip the initial location change
119-
120-
$scope.$on('$locationChangeStart', function(event) {
121-
if (i++ && $scope.state.blockCount > 0) {
122-
event.preventDefault();
123-
}
118+
var fn = $scope.$on('$viewContentLoaded', function($event) {
119+
fn();
120+
$scope.$on('$locationChangeStart', function(event) {
121+
if ($scope.state.blockCount > 0) {
122+
event.preventDefault();
123+
}
124+
});
124125
});
125126
}
126127
};

package/angular-block-ui/angular-block-ui.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular-block-ui/angular-block-ui.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,13 @@
115115
link: function($scope, $element, $attrs) {
116116
$scope.state = blockUI.state();
117117

118-
var i = 0; // Skip the initial location change
119-
120-
$scope.$on('$locationChangeStart', function(event) {
121-
if (i++ && $scope.state.blockCount > 0) {
122-
event.preventDefault();
123-
}
118+
var fn = $scope.$on('$viewContentLoaded', function($event) {
119+
fn();
120+
$scope.$on('$locationChangeStart', function(event) {
121+
if ($scope.state.blockCount > 0) {
122+
event.preventDefault();
123+
}
124+
});
124125
});
125126
}
126127
};

0 commit comments

Comments
 (0)