Skip to content

Commit

Permalink
feat(collectionRepeat): if item-width/item-height not given, compute …
Browse files Browse the repository at this point in the history
…dimensions
  • Loading branch information
ajoslin committed Feb 24, 2015
1 parent 88aebad commit 432c7dc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/angular/directive/collectionRepeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ var ONE_PX_TRANSPARENT_IMG_SRC = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP//
var WIDTH_HEIGHT_REGEX = /height:.*?px;\s*width:.*?px/;
var DEFAULT_RENDER_BUFFER = 10;

CollectionRepeatDirective.$inject = ['$ionicCollectionManager', '$parse', '$window'];
function CollectionRepeatDirective($ionicCollectionManager, $parse, $window) {
CollectionRepeatDirective.$inject = ['$ionicCollectionManager', '$parse', '$window', '$$rAF'];
function CollectionRepeatDirective($ionicCollectionManager, $parse, $window, $$rAF) {
return {
restrict: 'A',
priority: 1000,
Expand Down Expand Up @@ -173,6 +173,7 @@ function CollectionRepeatDirective($ionicCollectionManager, $parse, $window) {
scrollView.__content.appendChild(afterItemsContainer[0]);
}

$$rAF(refreshDimensions);
scrollCtrl.$element.one('scroll.init', refreshDimensions);

var onWindowResize = ionic.animationFrameThrottle(validateResize);
Expand Down Expand Up @@ -298,6 +299,7 @@ function CollectionRepeatDirective($ionicCollectionManager, $parse, $window) {
computedStyleNode = clone[0];
});
}
computedStyleScope[keyExpr] = ($parse(listExpr)(scope) || [])[0];
containerNode.appendChild(computedStyleNode);

var style = $window.getComputedStyle(computedStyleNode);
Expand Down

0 comments on commit 432c7dc

Please sign in to comment.