mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
put some template changes in compile
This commit is contained in:
18
js/ext/angular/src/directive/ionicContent.js
vendored
18
js/ext/angular/src/directive/ionicContent.js
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user