This is my html code
<ion-searchbar [(ngModel)]="data" placeholder="Airlines" (ionInput)="getAirlines($event)">
</ion-searchbar>
<ion-list *ngIf="data">
<ion-item *ngFor="let item of airlines" (click)="airlinesClicked($event, item)">
<button ion-button item-start clear style="margin-right:2%; width:10%;height:10%" no-padding>
<img no-padding src="{{item.logo}}">
</button>
{{item.name}}
</ion-item>
</ion-list>
Iam trying to get searched result as list by filtering by each letters. While i am searching my list pushing my below contents down in my page. So i like to get my item as popover. Can anyone help me to get my result......
Thanks in advance
I'm not pretty sure but maybe when the data is ready you can create a popover controller and the resize the page.
import { PopoverController } from 'ionic-angular';
#Component({})
class yourClassName {
constructor(public PopOverCtrl: PopoverController) {}
presentPopover(event) {
let popover = this.popoverCtrl.create(ListPage);
popover.present({
ev: event
});
}
}
more details on Ionic website
You can use bootstrap for the following class tags
and create a custom list popover on ion-searchbar
<ion-row>
<ion-searchbar
(ionChange)="getAirlines($event)"
[(ngModel)]="data" placeholder="Airlines"
></ion-searchbar>
</ion-row>
<ion-row>
<ul
class="list-group position-absolute px-2 search-list w-100 rounded-2 shadow-sm"
*ngIf="data">
<li
*ngFor="let item of airlines"
class="list-group-item"
(click)="airlinesClicked($event,item)">
{{item.name}}
</li>
</ul>
</ion-row>
-----css
.search-list{
z-index: 9;
max-height: 150px;
overflow-y: auto;
}
Related
I have a side menu always visible in my ionic aplication, the problem is I don't know how to change the #shadow-root css, I tried a few things but still don't work.
The problem is that when I make the menu smaller and empty space is left there. I want to remove that empty space, because when the screen is bigger the empty space is even bigger.
I searched in the debug console and this is the troublesome element:
This is my code:
HTML:
<ion-split-pane contentId="side-menu" class="menu-left" when="md">
<ion-menu side="start" menuId="side-menu" contentId="side-menu" mode="md" class="menu2">
<ion-header>
<ion-toolbar>
<ion-title>Start Menu</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list lines="none" class="menu-content">
<ion-item (click)="navigateHome()">
<ion-icon name="home" slot="start"></ion-icon>
<ion-label>Inicio</ion-label>
</ion-item>
<ion-item (click)="navigateAnimes()">
<ion-icon name="library" slot="start"></ion-icon>
<ion-label>Animes</ion-label>
</ion-item>
<ion-item (click)="navigateMine()">
<ion-icon name="bookmarks" slot="start"></ion-icon>
<ion-label>Mi lista</ion-label>
</ion-item>
<ion-item (click)="navigateSettings()">
<ion-icon name="options" slot="start"></ion-icon>
<ion-label>Ajustes</ion-label>
</ion-item>
</ion-list>
</ion-content>
</ion-menu>
<ion-router-outlet id="side-menu"></ion-router-outlet>
</ion-split-pane>
CSS:
.menu-left{
--width: 200px;
}
.menu-content {
height: 100% !important;
width: 200px;
}
Can anyone tell me how to apply my css attributes to the inner-scroll scroll-y in the shadow class please?
#phantomiam123 I updated my css class and doesn't work:
My css class now is:
.menu-left{
--width: 200px;
}
.menu-content {
height: 100% !important;
width: 200px;
}
.inner-scroll .scroll-y {
width: 200px;
}
And in the debug console:
This seems to work for me for now:
.split-pane-visible > ion-menu {
max-width: 200px!important;
}
my Ionic applications has a bottom tabs, where I can choice different tab/page. Each tab/page has different top tabs, but I want to keep the some header sections for the entire app, where on the right there is the Logo of the App and on the right an ion-avatar, where when I click on them I can choice different user. How Can I achieve this?
<ion-header color="primary">
<ion-item color="primary">
<div width-50 item-start>
<img src="assets/icon/myLogo.png">
</div>
<div width-50 item-end>
<img src="assets/icon/avatar-icon.png">
</div>
</ion-item>
<ion-toolbar color="primary">
<ion-segment [(ngModel)]="topTab" (ionChange)="onTabChanged()">
<ion-segment-button value="send" >
<ion-icon color="light" title="Invia" name="send">Invia</ion-icon>
<ion-label>Invia</ion-label>
</ion-segment-button>
<ion-segment-button value="calendar" >
<ion-icon color="light" title="Inviate" name="calendar"></ion-icon>
<ion-label>Inviate</ion-label>
</ion-segment-button>
</ion-segment>
</ion-toolbar>
</ion-header>
<ion-content>...
How Can I achieve this? Also I'm not able to se the first image on the left and the second one on the right, where am I wrong?
You can create a custom header component and add the tag wherever you want.
For example:
#Component({
selector: 'my-header',
template: '<ion-header color="primary"> ... </ion-header>'
})
export class MyHeader{ ... }
and add <my-header> in the pages you want.
Regarding the images, you can use the grid system in Ionic.
<ion-grid>
<ion-row>
<ion-col>
<img src="assets/icon/myLogo.png">
</ion-col>
<ion-col>
<img src="assets/icon/avatar-icon.png">
</ion-col>
</ion-row>
</ion-grid>
I'm trying to implement the ion-item-sliding option to create an ion-card that can slide within a flex-box grid. Unfortunately, it doesn't seem to work very well.
To be specific, nothing actually happens! No matter what direction I swipe from, there is no indication of a swipe taking place.
Here is what I have so far:
<ion-content padding>
<ion-grid>
<ion-row>
<ion-col col-6 offset-sm-3 *ngFor = "let list of listRef | async">
<ion-item-sliding>
<ion-item>
<ion-card>
<img *ngIf="list.color=='#f55f7c'" src="data:image/png;base64,iVBORw0dsfladj=">
<img *ngIf="list.color=='#ffcb53'" src="data:image/png;base64,iVB5CYII=">
<img *ngIf="list.color=='#85dec8'" src="data:image/png;base64,iVBORw0KGgoAAAANSU=">
</ion-card>
</ion-item>
</ion-item-sliding>
<ion-item-options side="left">
<button ion-button>Favorite</button>
<button ion-button color="danger">Share</button>
</ion-item-options>
</ion-col>
<button id="add-bttn" ion-button [navPush]="goNew"><ion-icon name="add"></ion-icon></button>
</ion-row>
</ion-grid>
</ion-content>
I've tried it with the *ngFor statement placed within the tag and in the tag. No go.
Any help would be enlightening!
Just like you can see in the Docs, the ion-item-options should be within the ion-item-sliding element. Besides, the items should be placed inside of an ion-list container.
So something like this should work:
<ion-content padding>
<ion-list> <!-- Here I've added the ion-list -->
<ion-row>
<ion-col col-6 offset-sm-3 *ngFor = "let list of listRef | async">
<ion-item-sliding>
<!-- Item -->
<ion-item>
<ion-card>
<img src="https://randomuser.me/api/portraits/men/51.jpg">
</ion-card>
</ion-item>
<!-- Options -->
<ion-item-options side="left">
<button ion-button>Favorite</button>
<button ion-button color="danger">Share</button>
</ion-item-options>
</ion-item-sliding> <!-- This includes the options-->
</ion-col>
<button id="add-bttn" ion-button [navPush]="goNew">
<ion-icon name="add"></ion-icon>
</button>
</ion-row>
</ion-list>
</ion-content>
Stackblitz project
I've create a side menu.
and button inside it
<ion-content style="background-image: url(assets/imgs/background.jpg)" >
<div id="sideBody">
<ion-list>
<button menuClose ion-item *ngFor="let p of Func.getPages()" (click)="openPage(p, p.title)">
{{p.title}}
</button>
</ion-list>
</div>
</ion-content>
</ion-menu>
how to make underline inside menu not showing and how change color text menu?
<ion-list no-lines>
<button menuClose ion-item *ngFor="let p of Func.getPages()" (click)="openPage(p, p.title)">
{{p.title}}
</button>
</ion-list>
Simply by putting no-lines property in like above i had edited your code.
I doing thank you page in my project. in success call it will display ORDER DETAILS and Delivery Details & Failure call it will display only ORDER DETAILS..
Success call is working fine but failure call not displaying order details...
below is my html code..
<!--
Generated template for the ThankYouPage page.
See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar>
<ion-title>Order Summary</ion-title>
<ion-buttons end>
<button ion-button icon-only>
<ion-icon name="share"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content>
<div *ngIf="orderSuccess">
<ion-item no-lines>
<ion-row>
<ion-icon ios="ios-checkmark-circle" md="md-checkmark-circle" class="success"></ion-icon>
</ion-row>
<ion-row class="text-center">
<p>Thank you. Your order has been</p>
</ion-row>
<ion-row class="text-center"><p>Successfully Placed.</p></ion-row>
</ion-item>
<hr>
</div>
<div *ngIf="orderFailure">
<ion-item>
<ion-row>
<ion-icon ios="ios-close-circle" md="md-close-circle" class="failure"></ion-icon>
</ion-row>
<ion-row class="text-center">
<p>Sorry! Failed to place your order.</p>
</ion-row>
<ion-card>
<ion-card-content>
Your Order could not be completed because of the-"System Generated Issue"
</ion-card-content>
</ion-card>
</ion-item>
</div>
<ion-item *ngFor=" let item of orderDetailsArray">
<div class="div"> Order Details </div>
<ion-row *ngIf="orderSuccess">
<ion-col class="down">Order Date</ion-col><br>
<ion-col class="down">{{item.date_added | date:'MMM-dd-yyyy'}}</ion-col>
</ion-row>
<ion-row *ngIf="orderSuccess">
<ion-col>Order number</ion-col><br>
<ion-col>{{item.order_id}}</ion-col>
</ion-row>
<hr>
<ion-row class="row">
<ion-col class="lightbold">Order Total</ion-col><br>
<ion-col class="bold">$ {{item.total}}</ion-col>
</ion-row>
<ion-row class="pay">
<ion-col>Payment method:</ion-col><br>
<ion-col class="color">{{item.payment_method}}</ion-col>
</ion-row>
</ion-item>
<div *ngIf="orderSuccess">
<ion-item *ngFor=" let item of orderDetailsArray">
<div class="div"> Delivery Details </div>
<div class="font">
<div>{{item.shipping_firstname}} {{item.shipping_lastname}}</div>
<div>{{item.shipping_address_1}} , {{item.shipping_address_2}}</div>
<div>{{item.shipping_city}}, {{item.shipping_postcode}}</div>
<div>{{item.shipping_zone}}</div>
<div class="phone">
<ion-icon ios="ios-call" md="md-call" item-left></ion-icon>
<span>{{item.telephone}}</span>
</div>
<div class="mail">
<ion-icon ios="ios-mail" md="md-mail" item-left></ion-icon>
<span>{{item.email}}</span>
</div>
</div>
</ion-item>
</div>
</ion-content>
<ion-footer>
<ion-toolbar color="primary">
<div *ngIf="orderSuccess">
<ion-row class="center" (click)="submit();"> GO BACK HOME </ion-row>
</div>
<div *ngIf="orderFailure">
<ion-row class="center" (click)="submit();"> GO BACK HOME </ion-row>
</div>
</ion-toolbar>
</ion-footer>
below is my ts file...
import { Component } from '#angular/core';
import { NavController } from 'ionic-angular';
import { Rest } from '../../providers/network/rest';
import { Logger } from '../../providers/logger/logger';
/*
Generated class for the ThankYou page.
See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
#Component({
selector: 'page-thank-you',
templateUrl: 'thank-you.html'
})
export class ThankYouPage {
orderDetailsArray = [];
public orderSuccess:boolean =false;
public orderFailure:boolean =false;
constructor(public navCtrl: NavController,
public rest: Rest,
public logger: Logger) {}
ionViewDidLoad() {
this.rest.get('/getOrder&order_id=0')
.subscribe((result) => {
console.log("checking getOrder"+JSON.stringify(result));
if(result.status == '1'){
console.log("success of getOrder");
this.orderDetailsArray=result.order;
this.orderSuccess=true;
}
else{
console.log("error of getOrder");
this.orderFailure = true;
}
})
}
submit(){
//this.navCtrl.setRoot(HomePage,{});
}
notSubmit(){
//this.navCtrl.push(PaymentPage,{});
}
}
Success call is working fine but failure call is not displaying order details...
It's because you are only setting the orderDetailsArray if your result.status is 1!
You should do it like this:
ionViewDidLoad() {
this.rest.get('/getOrder&order_id=0')
.subscribe((result) => {
console.log("checking getOrder"+JSON.stringify(result));
this.orderDetailsArray=result.order; // <-- place it here !
if(result.status == '1') {
console.log("success of getOrder");
this.orderSuccess=true;
}
else {
console.log("error of getOrder");
this.orderFailure = true;
}
});
}
You can also use this to convert result.status into Integer.Try this because status should always come in integer type and you are using string.I hope it will help you.
if(((result.status)*1) == 1) {...}