mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
refactor(collectionRepeat): add a require-able controller to the directive
This commit is contained in:
9
js/angular/directive/collectionRepeat.js
vendored
9
js/angular/directive/collectionRepeat.js
vendored
@@ -18,19 +18,19 @@
|
||||
* Here are a few things to keep in mind while using collection-repeat:
|
||||
*
|
||||
* 1. The data supplied to collection-repeat must be an array.
|
||||
* 2. You must explicitly tell the directive what size your items will be in the DOM, using directive attributes.
|
||||
* 2. You must explicitly tell the directive what size your items will be in the DOM, using directive attributes.
|
||||
* Pixel amounts or percentages are allowed (see below).
|
||||
* 3. The elements rendered will be absolutely positioned: be sure to let your CSS work with
|
||||
* this (see below).
|
||||
* 4. Keep the HTML of your repeated elements as simple as possible.
|
||||
* The more complicated your elements, the more likely it is that the on-demand compilation will cause
|
||||
* The more complicated your elements, the more likely it is that the on-demand compilation will cause
|
||||
* some jerkiness in the user's scrolling.
|
||||
* 6. Each collection-repeat list will take up all of its parent scrollView's space.
|
||||
* If you wish to have multiple lists on one page, put each list within its own
|
||||
* {@link ionic.directive:ionScroll ionScroll} container.
|
||||
* 7. You should not use the ng-show and ng-hide directives on your ion-content/ion-scroll elements that
|
||||
* have a collection-repeat inside. ng-show and ng-hide apply the `display: none` css rule to the content's
|
||||
* style, causing the scrollView to read the width and height of the content as 0. Resultingly,
|
||||
* style, causing the scrollView to read the width and height of the content as 0. Resultingly,
|
||||
* collection-repeat will render elements that have just been un-hidden incorrectly.
|
||||
*
|
||||
*
|
||||
@@ -88,7 +88,7 @@
|
||||
* </div>
|
||||
* </ion-content>
|
||||
* ```
|
||||
* Percentage of total visible list dimensions. This example shows a 3 by 3 matrix that fits on the screen (3 rows and 3 colums). Note that dimensions are used in the creation of the element and therefore a measurement of the item cannnot be used as an input dimension.
|
||||
* Percentage of total visible list dimensions. This example shows a 3 by 3 matrix that fits on the screen (3 rows and 3 colums). Note that dimensions are used in the creation of the element and therefore a measurement of the item cannnot be used as an input dimension.
|
||||
* ```css
|
||||
* .my-image-item img {
|
||||
* height: 33%;
|
||||
@@ -147,6 +147,7 @@ function($collectionRepeatManager, $collectionDataSource, $parse) {
|
||||
terminal: true,
|
||||
$$tlb: true,
|
||||
require: '^$ionicScroll',
|
||||
controller: [function(){}],
|
||||
link: function($scope, $element, $attr, scrollCtrl, $transclude) {
|
||||
var scrollView = scrollCtrl.scrollView;
|
||||
if (scrollView.options.scrollingX && scrollView.options.scrollingY) {
|
||||
|
||||
Reference in New Issue
Block a user