Ionic - Dynamic content inside ionic modal prevents to scroll upward - ionic-framework

When I try to dynamically add content in MODAL(overflow-scroll is set false), the page adds white space at the bottom of page and prevents me to scroll up to reach the top of "ion-content".
Can anyone help me?
My code:
<ion-modal-view>
<ion-header-bar>
....
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item ng-repeat="fc in query.filterChoices">
...
</ion-item>
</ion-list>
<div class="row">
<div class="col col-20">
</div>
<div class="col col-60">
<button class="button button-stable button-block" ng-click="addFilterChoice();">
Add Filter
</button>
</div>
<div class="col col-40">
</div>
</div>
</ion-content>

Related

ionic2 How to put an element outside of modal

I want to add an element outside of modal using Ionic2 like the image below.
The area surrounded by blue border is the element that I want to add.
The area surrounded by red border is the custom modal that I have created.
Custom Modal.html
<ion-header>
<ion-navbar class="select-header">
<ion-buttons left (click)="close()">
<button ion-button>
<img class="close" src="assets/images/close.png"/>
</button>
</ion-buttons>
<ion-title>{{title}}</ion-title>
</ion-navbar>
</ion-header>
<ion-content class="region-selection">
<div class="select-all">
<img class="selection not-selected" src="assets/images/region/check_none.png"/>
<span>{{title}}</span>
</div>
<div class="select-region">
<ion-row class="regions-row" *ngFor="let row of rowsArray; let last = last" [ngClass]="{ last: last }">
<ion-col *ngFor="let region of regions | slice:(row*3):(row+1)*3">
<img class="selection not-selected" src="assets/images/region/check_none.png"/>
<span [innerHtml]="region"></span>
</ion-col>
</ion-row>
</div>
</ion-content>
Try placing all your items inside the ion-content and remove the ion-header to have a structure like this
<ion-content class="region-selection">
<div class="outside-element">
<!--element outside of modal-->
</div>
<!--This is your modal header wrapper-->
<div class="modal-header">
<ion-buttons left (click)="close()">
<button ion-button>
<img class="close" src="assets/images/close.png" />
</button>
</ion-buttons>
<ion-title>{{title}}</ion-title>
</div>
<!--This is your modal header wrapper-->
<div class="modal-content">
<div class="select-all">
<img class="selection not-selected" src="assets/images/region/check_none.png" />
<span>{{title}}</span>
</div>
<div class="select-region">
<ion-row class="regions-row" *ngFor="let row of rowsArray; let last = last" [ngClass]="{ last: last }">
<ion-col *ngFor="let region of regions | slice:(row*3):(row+1)*3">
<img class="selection not-selected" src="assets/images/region/check_none.png" />
<span [innerHtml]="region"></span>
</ion-col>
</ion-row>
</div>
</div>
</ion-content>
Now you can use css to style and position the elements using the classes .outside-element , .modal-header , .modal-content
Also, make sure to set your background-color to transparent

Have page slide in from right side ionic

I'm trying to add a transition where a user clicks on a button and the next page slides in from the right side.
Is that easy to do with the Ionic Framework?
I can't seem to find how to do that.
Here is what I have on my view:
<ion-view title="Payment" cache-view="false">
<ion-content padding="false" class="has-header">
<div class="container">
<div class="spacer" style="width: 290px; height: 31px;"></div>
<div class="show-list-numbers-and-dots">
<p style="color:#000000;">Payment Methods</p>
</div>
</div>
<ion-list>
<ion-item class="item-icon-left item-icon-right">
<i class="icon ion-card"></i>.... 2039
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
<ion-item class="calm" ui-sref="paymentPage">Add Payment Method</ion-item>
</ion-list>
<div class="spacer" style="width: 290px; height: 44px;"></div>
</ion-content>
</ion-view>
check this from official docs
slides component
First disable swipe and then on button click you can call this function for transition
slideTo(index, speed, runCallbacks)

Ionic 1 : Delay in alpha indexed list with large data

I am getting issue while redirecting to ion-list template with approx. 700 items. There comes a delay of around 4-5 seconds which is decreasing performance.Below is my code. Can someone please suggest me the solution?
<ion-modal-view class="bgImg">
<ion-view>
<ion-header-bar class="bar-light">
<h1><img class="title-image titleImg" src="img/logoIB.png"/></h1>
<div class="buttons button-clear">
<button class="button button-clear" ng-click="refreshList()" style="margin-top:40px;"><i class="icon ion-refresh" style="font-size:30px;"></i></button>
</div>
</ion-header-bar>
<ion-content scroll="true" >
<div data-ng-repeat="(letter, authors) in sorted_users" class="alpha_list">
<ion-item class="item item-divider" id="index_{{letter}}">
{{letter}}
</ion-item>
<ion-item ng-repeat="author in authors" ng-click="getSelectedUser(author.user_id,author.passcode,author.gesturecode,author.username)">
{{author.last_name}} {{author.first_name}}
</ion-item>
</div>
</ion-content>
<ul class="alpha_sidebar">
<li ng-click="gotoList('index_{{letter}}')" ng-repeat="letter in alphabet">
{{letter}}
</li>
</ul>
</ion-view>

Ion-slides is shown in the view only if ion-content scroll=false

I need a scrollable page with ion-slides directive. If i set scroll=true in ion-content the slider is not shown on the page. I'm running ionic 1.3.1 and using the new ion-slide directive. This is my code,
<ion-content class="padding" scroll="false">
<div class="list card">
<div class="item no-padding">
<img class="full-image" src="http://12.jpg">
</div>
<div class="item ">
<button class="button icon-left ion-android-navigate button-stable">Directions </button>
<button class="button icon-left ion-ios-telephone button-stable">Call </button>
<button class="button icon-left ion-android-share-alt button-stable">Share</button>
</div>
</div>
<div class="slide-wrapper1">
<ion-slides options="options" slider="data.slider">
<ion-slide-page>
<img src="http://placehold.it/375x468/">
</ion-slide-page>
<ion-slide-page>
<img src="http://placehold.it/375x468/0000">
</ion-slide-page>
<ion-slide-page>
<img src="http://placehold.it/375x468/">
</ion-slide-page>
</ion-slides>
</div>
<h4>About </h4>
<div class="card">
<div class="item item-text-wrap">
This is a basic Card which contains an item that has wrapping text.
</div>
</div>
</ion-content>
what am i doing wrong, How do i get the ion-slides to work in a scrollable page?
Thanks for any help
How about wrapping the inside of your ion-slide-page with an ion-content like:
<div class="slide-wrapper1">
<ion-slides options="options" slider="data.slider">
<ion-slide-page>
<ion-content has-header="true" padding="true">
<img src="http://placehold.it/375x468/">
</ion-content>
</ion-slide-page>
</ion-slides>
</div>
I would like to note that this should work with Android. I think I had to remove the ion-content for iOS to work on the device.
*Edit - Also, my outside ion-content is set to true

Ionic swipe back gesture enable

I have the following code:
personal-info.html
<ion-view view-title="Personal Information" can-swipe-back="true">
<ion-nav-buttons side="left">
<button class="button button-icon icon ion-ios-arrow-left" ng-click="doTheBack()" nav-direction="back"></button>
</ion-nav-buttons>
<ion-content class="padding">
<div class="list card">
<div class="item item-divider">Recent Updates</div>
<div class="item item-body">
<div>
There is a fire in <b>sector 3</b>
</div>
</div>
</div>
</ion-content>
</ion-view>
and my controller
.controller('PersonalInfoCtrl', function($scope) {
$scope.doTheBack = function() {
window.history.back();
};
});
I want to enable the swipe back feature I tried by putting can-swipe-back="true" inside <ion-view> tag but it didn't help at all. Also I have checked a lot of documentation as well as this question How do you "Swipe to go back" in Ionic? but it seems that swipe back feature is not enabled for my application.
The way I implemented it was through $ionicNavBarDelegate.
In HTML:
<ion-view view-title="Personal Information">
<ion-content on-swipe-right="swipe('right')" class="padding">
<div class="list card">
<div class="item item-divider">Recent Updates</div>
<div class="item item-body">
<div>
There is a fire in <b>sector 3</b>
</div>
</div>
</div>
</ion-content>
</ion-view>
In controller:
$scope.swipe = function (direction) {
if(direction == 'right')
$ionicNavBarDelegate.back();
}
Make sure to include $ionicNavBarDelegate in your controller header.
If that doesn't work, take a look at http://forum.ionicframework.com/t/any-sample-code-on-how-to-use-swipe-to-go-back/19122/13. Swipe-to-go-back seems to work by default since RC0 as demonstrated by http://codepen.io/mhartington/pen/RNqpJp.