mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
added watch to element height and extended timeout to 500ms
This commit is contained in:
18
js/ext/angular/src/directive/ionicContent.js
vendored
18
js/ext/angular/src/directive/ionicContent.js
vendored
@@ -70,6 +70,20 @@ angular.module('ionic.ui.content', [])
|
||||
// Otherwise, supercharge this baby!
|
||||
// Add timeout to let content render so Scroller.resize grabs the right content height
|
||||
$timeout(function() {
|
||||
|
||||
// Add watch to the container element's height to fire Scroller.resize event
|
||||
$scope.$watch
|
||||
(
|
||||
function () {
|
||||
return typeof($element) !== "undefined" && $element.length > 0 && $element[0].clientHeight > 0 ? $element[0].clientHeight : 0;
|
||||
},
|
||||
function (newValue, oldValue) {
|
||||
if (newValue != oldValue && $scope.$parent && $scope.$parent.scrollView && $scope.$parent.scrollView.resize) {
|
||||
$scope.$parent.scrollView.resize();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
sv = new ionic.views.Scroller({
|
||||
el: $element[0]
|
||||
});
|
||||
@@ -87,7 +101,9 @@ angular.module('ionic.ui.content', [])
|
||||
*/
|
||||
// Let child scopes access this
|
||||
$scope.$parent.scrollView = sv;
|
||||
}, 100);
|
||||
}, 500);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user