mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
Fixed #77, scroll support for <content> dir
This commit is contained in:
19
js/ext/angular/src/directive/ionicContent.js
vendored
19
js/ext/angular/src/directive/ionicContent.js
vendored
@ -18,7 +18,7 @@ angular.module('ionic.ui.content', [])
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
template: '<div class="content"></div>',
|
||||
template: '<div class="scroll-content"><div class="scroll"></div></div>',
|
||||
transclude: true,
|
||||
compile: function(element, attr, transclude) {
|
||||
return function($scope, $element, $attr) {
|
||||
@ -37,7 +37,22 @@ angular.module('ionic.ui.content', [])
|
||||
if(attr.hasTabs) {
|
||||
c.addClass('has-tabs');
|
||||
}
|
||||
$element.append(transclude($scope));
|
||||
|
||||
|
||||
// If they want plain overflows scrolling, add that as a class
|
||||
if(attr.overflowScroll === "true") {
|
||||
c.addClass('overflow-scroll');
|
||||
} else {
|
||||
// Otherwise, supercharge this baby!
|
||||
var sv = new ionic.views.Scroll({
|
||||
el: $element[0].firstElementChild
|
||||
});
|
||||
// Let child scopes access this
|
||||
$scope.scrollView = sv;
|
||||
}
|
||||
|
||||
var clone = transclude($scope);
|
||||
angular.element($element[0].firstElementChild).append(clone);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
22
js/ext/angular/src/directive/ionicScroll.js
vendored
22
js/ext/angular/src/directive/ionicScroll.js
vendored
@ -1,22 +0,0 @@
|
||||
(function(ionic) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @description
|
||||
* The scroll directive lets you enable a content area for
|
||||
* our custom momentum scrolling area. The benefit to a custom
|
||||
* scroll area is configurability, and avoidance of the
|
||||
* buggy -webkit-overflow-scrolling: touch.
|
||||
*/
|
||||
|
||||
angular.module('ionic.ui.scroll', [])
|
||||
|
||||
.directive('scroll', function() {
|
||||
return {
|
||||
restrict: 'ECA',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
template: '<div class="scroll-content" ng-transclude></div>'
|
||||
};
|
||||
});
|
||||
})(window.ionic);
|
||||
1
js/ext/angular/src/ionicAngular.js
vendored
1
js/ext/angular/src/ionicAngular.js
vendored
@ -14,6 +14,7 @@ angular.module('ionic.service', [
|
||||
|
||||
angular.module('ionic.ui', [
|
||||
'ionic.ui.content',
|
||||
'ionic.ui.scroll',
|
||||
'ionic.ui.tabs',
|
||||
'ionic.ui.nav',
|
||||
'ionic.ui.sideMenu',
|
||||
|
||||
Reference in New Issue
Block a user