JS CraftCamp 2016
<ion-content>
<ion-list>
<ion-item ng-click="ctrl.detail(item)" ng-repeat="item in results">
<!-- item UI -->
</ion-item>
</ion-list>
</ion-content>
function MasterController ($ionicModal, $scope) {
$ionicModal.fromTemplateUrl('detail.html', {
scope: detailScope,
animation: 'slide-in-up'
}).then(function(modal) {
this.modal = modal;
});
this.detail = function (item) {
scope.item = item;
this.modal.show();
};
}
<ion-slide-box active-slide="slideBox.index">
<ion-slide ng-repeat="item in results">
<div ng-if="$index > (slideBox.index - 2)
&& $index < (slideBox.index + 2)">
<ion-content overflow-scroll="true">
..
</ion-content>
</div>
</ion-slide>
</ion-slide-box>
<ion-content>
<!-- cheap UI -->
<div ng-if="ctrl.deferred" class="placeholder">
<!-- expensive UI -->
</div>
</ion-content>
function DeferredController ($scope, $timeout) {
$scope.$on('$ionicView.enter', function {
$timeout(function () {
this.deferred = true;
}, 500);
});
...
}
<ion-content>
<div ng-repeat="item in results | limitTo: ctrl.renderedResults"
class="card result">
...
</div>
<ion-infinite-scroll on-infinite="ctrl.addResults()"
distance="1%" immediate-check="false"></ion-infinite-scroll>
</ion-content>
function ResultsController ($scope) {
this.renderMore = function (slide) {
this.renderedResults *= 3;
$scope.$broadcast('scroll.infiniteScrollComplete');
};
...
}