mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
refact(ionContent): make docs match src
This commit is contained in:
@@ -41,7 +41,7 @@ angular.module('ionic.ui.scroll')
|
||||
var refresherHeight = self.refresher.clientHeight || 0;
|
||||
scrollView.activatePullToRefresh(refresherHeight, function() {
|
||||
refresher.classList.add('active');
|
||||
refresherScope.$onRefreshOpening();
|
||||
refresherScope.$onPulling();
|
||||
}, function() {
|
||||
refresher.classList.remove('refreshing');
|
||||
refresher.classList.remove('active');
|
||||
|
||||
37
js/ext/angular/src/directive/ionicContent.js
vendored
37
js/ext/angular/src/directive/ionicContent.js
vendored
@@ -30,27 +30,27 @@ angular.module('ionic.ui.content', ['ionic.ui.service', 'ionic.ui.scroll'])
|
||||
* @module ionic
|
||||
*
|
||||
* @description
|
||||
* The ionContent directive provides an easy to use content area that can be configured
|
||||
* The ionContent directive provides an easy to use content area that can be configured
|
||||
* to use Ionic's custom Scroll View, or the built in overflow scorlling of the browser.
|
||||
*
|
||||
* While we recommend using the custom Scroll features in Ionic in most cases, sometimes
|
||||
* While we recommend using the custom Scroll features in Ionic in most cases, sometimes
|
||||
* (for performance reasons) only the browser's native overflow scrolling will suffice,
|
||||
* and so we've made it easy to toggle between the Ionic scroll implementation and
|
||||
* and so we've made it easy to toggle between the Ionic scroll implementation and
|
||||
* overflow scrolling.
|
||||
*
|
||||
* You can implement pull-to-refresh with the {@link ionic.directive:ionRefresher}
|
||||
* directive, and infinite scrolling with the {@link ionic.directive:ionInfiniteScroll}
|
||||
* You can implement pull-to-refresh with the {@link ionic.directive:ionRefresher}
|
||||
* directive, and infinite scrolling with the {@link ionic.directive:ionInfiniteScroll}
|
||||
* directive.
|
||||
*
|
||||
* @restrict E
|
||||
* @param {boolean=} scroll Whether to allow scrolling of content. Defaults to true.
|
||||
* @param {boolean=} overflow-scroll Whether to use overflow-scrolling instead of
|
||||
* @param {boolean=} overflow-scroll Whether to use overflow-scrolling instead of
|
||||
* Ionic scroll.
|
||||
* @param {boolean=} padding Whether to add padding to the content.
|
||||
* @param {boolean=} has-header Whether to offset the content for a header bar.
|
||||
* @param {boolean=} has-subheader Whether to offset the content for a subheader bar.
|
||||
* @param {boolean=} has-footer Whether to offset the content for a footer bar.
|
||||
* @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges
|
||||
* @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges
|
||||
* of the content. Defaults to true on iOS, false on Android.
|
||||
* @param {expression=} on-scroll Expression to evaluate when the content is scrolled.
|
||||
* @param {expression=} on-scroll-complete Expression to evaluate when a scroll action completes.
|
||||
@@ -90,9 +90,6 @@ function($parse, $timeout, $ionicScrollDelegate, $controller, $ionicBind) {
|
||||
scrollContent = angular.element($element[0].querySelector('.scroll'));
|
||||
|
||||
$ionicBind($scope, $attr, {
|
||||
//Use $ to stop onRefresh from recursively calling itself
|
||||
$onRefresh: '&onRefresh',
|
||||
$onRefreshOpening: '&onRefreshOpening',
|
||||
$onScroll: '&onScroll',
|
||||
$onScrollComplete: '&onScrollComplete',
|
||||
hasBouncing: '@',
|
||||
@@ -151,14 +148,6 @@ function($parse, $timeout, $ionicScrollDelegate, $controller, $ionicBind) {
|
||||
});
|
||||
});
|
||||
|
||||
if(attr.refreshComplete) {
|
||||
$scope.refreshComplete = function() {
|
||||
if($scope.scrollView) {
|
||||
$scope.$parent.$broadcast('scroll.onRefreshComplete');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
transclude($scope, function(clone) {
|
||||
@@ -188,14 +177,14 @@ function($parse, $timeout, $ionicScrollDelegate, $controller, $ionicBind) {
|
||||
* When refreshing is complete, $broadcast the 'scroll.refreshComplete' event
|
||||
* from your controller.
|
||||
*
|
||||
* @param {expression=} on-refresh Called when the user pulls down enough and lets go
|
||||
* @param {expression=} on-refresh Called when the user pulls down enough and lets go
|
||||
* of the refresher.
|
||||
* @param {expression=} on-pulling Called when the user starts to pull down
|
||||
* @param {expression=} on-pulling Called when the user starts to pull down
|
||||
* on the refresher.
|
||||
* @param {string=} pulling-icon The icon to display while the user is pulling down.
|
||||
* @param {string=} pulling-icon The icon to display while the user is pulling down.
|
||||
* Default: 'ion-arrow-down-c'.
|
||||
* @param {string=} pulling-text The text to display while the user is pulling down.
|
||||
* @param {string=} refreshing-icon The icon to display after user lets go of the
|
||||
* @param {string=} pulling-text The text to display while the user is pulling down.
|
||||
* @param {string=} refreshing-icon The icon to display after user lets go of the
|
||||
* refresher.
|
||||
* @param {string=} refreshing-text The text to display after the user lets go of
|
||||
* the refresher.
|
||||
@@ -254,7 +243,7 @@ function($parse, $timeout, $ionicScrollDelegate, $controller, $ionicBind) {
|
||||
refreshingIcon: '@',
|
||||
refreshingText: '@',
|
||||
$onRefresh: '&onRefresh',
|
||||
$onRefreshOpening: '&onRefreshOpening'
|
||||
$onPulling: '&onPulling'
|
||||
});
|
||||
|
||||
scrollCtrl.setRefresher($scope, $element[0]);
|
||||
|
||||
@@ -92,7 +92,7 @@ describe('$ionicScroll Controller', function() {
|
||||
var scrollOnRefreshSpy = jasmine.createSpy('scroll.onRefresh');
|
||||
|
||||
scope.$onRefresh = jasmine.createSpy('onRefresh');
|
||||
scope.$onRefreshOpening = jasmine.createSpy('onRefreshOpening');
|
||||
scope.$onPulling = jasmine.createSpy('onPulling');
|
||||
|
||||
timeout.flush();
|
||||
var refresher = ctrl.refresher;
|
||||
@@ -103,7 +103,7 @@ describe('$ionicScroll Controller', function() {
|
||||
startCb();
|
||||
expect(refresher.classList.contains('active')).toBe(true);
|
||||
expect(refresher.classList.contains('refreshing')).toBe(false);
|
||||
expect(scope.$onRefreshOpening).toHaveBeenCalled();
|
||||
expect(scope.$onPulling).toHaveBeenCalled();
|
||||
|
||||
refreshingCb();
|
||||
expect(refresher.classList.contains('active')).toBe(false);
|
||||
|
||||
@@ -40,11 +40,11 @@ describe('ionRefresher directive', function() {
|
||||
|
||||
it('should bind $onRefreshOpening', function() {
|
||||
var spyMe = jasmine.createSpy('onRefreshOpening');
|
||||
var el = setup('on-refresh-opening="spyMe()"', {
|
||||
var el = setup('on-pulling="spyMe()"', {
|
||||
spyMe: spyMe
|
||||
});
|
||||
expect(spyMe).not.toHaveBeenCalled();
|
||||
el.scope().$onRefreshOpening();
|
||||
el.scope().$onPulling();
|
||||
expect(spyMe).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<ion-content has-header="true" scroll="true" ng-controller="ContentCtrl" has-footer="true" padding="false">
|
||||
|
||||
<ion-refresher on-refresh="onRefresh()" pulling-text="pull!"></ion-refresher>
|
||||
<ion-refresher on-refresh="onRefresh()" pulling-text="pull!" refreshing-text="refreshing!"></ion-refresher>
|
||||
|
||||
<ul class="list">
|
||||
<li class="item">This ion-list should *exactly* fit</li>
|
||||
|
||||
Reference in New Issue
Block a user