put some template changes in compile

This commit is contained in:
Adam Bradley
2014-01-07 20:03:33 -06:00
parent fe0862a126
commit 3b3c649071

View File

@@ -37,24 +37,25 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
scrollbarY: '@',
scrollEventInterval: '@'
},
compile: function(element, attr, transclude) {
return function($scope, $element, $attr) {
if(attr.hasHeader == "true") { element.addClass('has-header'); }
if(attr.hasSubheader == "true") { element.addClass('has-subheader'); }
if(attr.hasFooter == "true") { element.addClass('has-footer'); }
if(attr.hasTabs == "true") { element.addClass('has-tabs'); }
return function link($scope, $element, $attr) {
var clone, sc, sv,
addedPadding = false,
c = $element.eq(0);
if(attr.hasHeader == "true") { c.addClass('has-header'); }
if(attr.hasSubheader == "true") { c.addClass('has-subheader'); }
if(attr.hasFooter == "true") { c.addClass('has-footer'); }
if(attr.hasTabs == "true") { c.addClass('has-tabs'); }
// If they want plain overflow scrolling, add that as a class
if($scope.scroll === "false") {
clone = transclude($scope.$parent);
$element.append(clone);
} else if(attr.overflowScroll === "true") {
c.addClass('overflow-scroll');
clone = transclude($scope.$parent);
clone = transclude($scope.$parent);
$element.append(clone);
} else {
sc = document.createElement('div');
@@ -82,7 +83,6 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
};
}
// Otherwise, supercharge this baby!
$timeout(function() {
sv = new ionic.views.Scroll({
@@ -117,12 +117,10 @@ angular.module('ionic.ui.content', ['ionic.ui.service'])
// Register for scroll delegate event handling
ScrollDelegate.register($scope, $element);
// Let child scopes access this
$scope.$parent.scrollView = sv;
});
}
// if padding attribute is true, then add padding if it wasn't added to the .scroll