ion-router-outlet hides under ion menu in ionic angular - html

Following code works fine in mobile view but source code does not work in web view. screenshot is attaced with question. split pane is not working as per required. same is happening with every component. I have tried many things like host: style{width:70%} but nothing works. Basically it should acquire remaining space of page.
<ion-split-pane class="ion-menu" contentId="mis-menu-content" when="xl">
<ion-menu type="overlay" contentId="mis-menu-content" class="menu-gradient">
<ion-content>
<div *ngFor="let p of appPages">
<ion-list>
<ion-menu-toggle auto-hide="false" *ngIf="p.url">
<ion-item
[routerDirection]="'root'"
[routerLink]="[p.url]"
routerLinkActive="active"
>
<ion-img slot="start" class="imgset" [src]="p.icon"></ion-img>
<ion-label class="menu-font"> {{p.title}} </ion-label>
</ion-item>
</ion-menu-toggle>
<ion-item
button
*ngIf="p.children?.length>0"
(click)="p.open = !p.open"
[class.active-parent]="p.open"
detail="false"
>
<ion-img slot="start" class="imgset" [src]="p.icon"></ion-img>
<ion-icon
class="imgset"
slot="end"
name="chevron-forward-outline"
*ngIf="!p.open"
></ion-icon>
<ion-icon
class="imgset"
slot="end"
name="chevron-down-outline"
*ngIf="p.open"
></ion-icon>
<ion-label class="menu-font">{{p.title}}</ion-label>
</ion-item>
<ion-list class="item-md-list" *ngIf="p.open">
<ion-menu-toggle auto-hide="false" *ngFor="let sub of p.children">
<ion-item
[routerDirection]="'root'"
[routerLink]="[sub.url]"
routerLinkActive="active"
>
<ion-img
slot="start"
class="imgset-sub"
[src]="sub.icon"
></ion-img>
<ion-label class="menu-font-sub"> {{sub.title}} </ion-label>
</ion-item>
</ion-menu-toggle>
</ion-list>
</ion-list>
</div>
</ion-content>
</ion-menu>
<ion-router-outlet id="mis-menu-content" main>
<link href="roboto.css" type="text/html" />
<ion-row>
<ion-col size-lg="12" size-md="12" size-sm="12" size="12">
<ion-title class="welcomelogo"
><img src="../../../assets/img/pil logo.png"
/></ion-title>
<ion-title class="welcometxt">
Welcome <br /><ion-title class="welcometxt1">To</ion-title
><br /><ion-title class="welcometxt2">Operations Portal</ion-title>
</ion-title>
</ion-col>
</ion-row>
</ion-router-outlet>
</ion-split-pane>
}
.split-pane {
position: absolute;
/* top: $SPLIT_TOP; */
}
ion-menu[type="overlay"] {
z-index: 80;
position: fixed;
}
ion-menu[type="reveal"] {
z-index: 80;
}
.menu-item{
background:none;
color:white;
font-weight:300;
border:0px;
.item-content{
background:none;
&.activated{
/* background: $MENU_TRANSPARENCY; */
}
}
&.active-page-highlight{
.item-content{
/* background: $MENU_TRANSPARENCY; */
}
}
}

Related

How to center ionic avatar on a page

I am trying to center the avatar to the middle, with the code below but it doesn't work.
I have used this class="ion-align-items-center" that i got from the ionic documents but with no successs.
<ion-grid style ="text-align: center">
<ion-row class="ion-align-items-center" >
<ion-col class="ion-align-items-center" *ngFor="let item of students" >
<!-- <div class= "imageHold" >
<ion-img [src]= "profileImage || item.profileImage"></ion-img>
</div> -->
<ion-avatar class="ion-align-items-center">
<ion-img [src]= "profileImage || item.profileImage"></ion-img>
</ion-avatar>
</ion-col>
</ion-row >
<ion-row style ="text-align: center">
<ion-col>
<ion-button size="small" fill="outline" (click)="chooseProfilePic()" >Choose Profile Photo</ion-button>
</ion-col>
</ion-row>
</ion-grid>
I get this result
add a class in the avatar div.
.avatar{
margin: auto;
}

Hide default icon menu hamburger button on Ionic Menu | Ionic 4

I need to remove hamburger default icon menu on ionic menu. I've added custom menu and I need to remove default icon.
So my code:
<ion-menu side="start">
<ion-header>
<ion-toolbar>
<ion-title>Menu</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list>
<ion-item>
<ion-icon name="home" slot="start"></ion-icon>
<ion-label>Home</ion-label>
</ion-item>
<ion-item>
<ion-icon name="person" slot="start"></ion-icon>
<ion-label>Profile</ion-label>
</ion-item>
<ion-item>
<ion-icon name="chatbubbles" slot="start"></ion-icon>
<ion-label>Messages</ion-label>
</ion-item>
<ion-item>
<ion-icon name="settings" slot="start"></ion-icon>
<ion-label>Settings</ion-label>
</ion-item>
</ion-list>
</ion-content>
</ion-menu>
My layout menu:
Html button code:
<ion-header _ngcontent-yjt-c1="" role="banner" class="ios header-ios hydrated">
<ion-toolbar _ngcontent-yjt-c1="" class="ios hydrated">
<ion-buttons _ngcontent-yjt-c1="" slot="start" class="buttons-first-slot sc-ion-buttons-ios-h sc-ion-buttons-ios-s ios hydrated">
<ion-menu-button _ngcontent-yjt-c1="" class="hydrated ios button ion-activatable ion-focusable"></ion-menu-button>
</ion-buttons>
<ion-title _ngcontent-yjt-c1="" class="ios title-ios hydrated"></ion-title>
</ion-toolbar>
</ion-header>
I need to remove default icon inside circle. How to do to remove?
Can you please try the following css rules?
Can you please check if they don't work if they get added to the css of the page you are viewing?
ion-menu-button {
display: none !important;
}
or
ion-buttons {
display: none !important;
}
or
.button.ion-activatable.ion-focusable {
display: none !important;
}
Add the below styles in your app.scss file to hide the default menu button
.bar-button-menutoggle {
display: none !important;
}

how can I make the content of the tab start from the start of page not at the center ?

In order to make a page with sliding tabs in ionic 3 , I had tried an example from the internet to reach to my aim >> (sliding tabs)
It is work correctly and nice but the content of each tab align in the center of the page and I don't want it act like that , I want the content start from the beginning of the page like normal .
I have been search and tried to change that but I couldn't find the part of code which make content of a tab align at the center of page .
This is my HTML code :
<ion-header >
<ion-navbar>
<ion-title>
Latest Addition
</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<ion-segment class="SwipedTabs-tabs" >
<ion-segment-button *ngFor='let tab of tabs ; let i = index ' value="IngoreMe" (click)="selectTab(i)"
[ngClass]='{ "SwipedTabs-activeTab" : ( this.SwipedTabsSlider && ( this.SwipedTabsSlider.getActiveIndex() === i || ( tabs.length -1 === i&& this.SwipedTabsSlider.isEnd()))) }' >
{{tab}}
</ion-segment-button>
</ion-segment>
<!-- here is our dynamic line "indicator"-->
<div id='indicator' class="SwipedTabs-indicatorSegment" [ngStyle]="{'width.%': (100/this.tabs.length)}"></div>
<ion-slides #SwipedTabsSlider (ionSlideDrag)="animateIndicator($event)"
(ionSlideWillChange)="updateIndicatorPosition()"
(ionSlideDidChange)="updateIndicatorPosition()"
(pan)="updateIndicatorPosition()"
[pager]="false"
>
<ion-slide padding>
<ion-list>
<ion-item *ngFor="let a of adminL">
<ion-thumbnail item-start>
<img [src]="a.image"/>
</ion-thumbnail>
<ion-card color="k1">
<ion-card-header>
{{a.name}} in {{a.city}} city
</ion-card-header>
<ion-card-content>
{{a.address}} <br>
{{a.description}} <br>
</ion-card-content>
</ion-card>
</ion-item>
</ion-list>
</ion-slide>
<ion-slide>
<ion-list>
<ion-item *ngFor="let l of latest">
<ion-thumbnail item-start>
<img [src]="l.image1"/>
</ion-thumbnail>
<ion-card color="k2">
<ion-card-header>
{{l.user}} add :
</ion-card-header>
<ion-card-content>
{{l.title}} <br>
{{l.description}} <br>
{{l.city}} <br>
{{l.date}}
</ion-card-content>
</ion-card>
</ion-item>
</ion-list>
</ion-slide>
<ion-slide>
<ion-list>
<ion-item *ngFor="let j of jobs">
<ion-card color="k2">
<ion-card-header>
{{j.cat}} in {{j.country}} with {{j.salary}} salary
</ion-card-header>
<ion-card-content>
{{j.job}} <br>
{{j.email}} <br>
{{j.phone}} <br>
{{j.date}}
</ion-card-content>
</ion-card>
</ion-item>
</ion-list>
</ion-slide>
<ion-slide>
<ion-list>
<ion-item *ngFor="let n of news">
<ion-card color="k2">
<ion-card-header>
{{n.cat}} new from {{n.country}}
</ion-card-header>
<ion-card-content>
{{n.new}} <br>
{{n.date}}
</ion-card-content>
</ion-card>
</ion-item>
</ion-list>
</ion-slide>
</ion-slides>
</ion-content>
And this is my CSS code :
page-test {
.SwipedTabs-indicatorSegment
{
-webkit-transition: 0.3s all;
-moz-transition: 0.3s all;
-o-transition: 0.3s all;
transition: 0.3s all;
transform-origin: top 0 left 0;
height: 1px;
position: relative;
top: -2px;
background-color: black !important;
}
.SwipedTabs-tabs ion-segment-button
{
border:none !important;
color:gray!important;
background-color:white!important;
}
.SwipedTabs-tabs ion-segment-button.SwipedTabs-activeTab
{
color:black !important;
}
.SwipedTabs-tabs
{
border-bottom: solid 1px #e6e6e6 !important;
}
}
how can I make the content of the tab start from the start of page not at the center ?
how can I solve that ? where is the related code ?

Set grid layout properly

I need to structure the radio buttons as shown below.
image 1
I have tried as shown below.
.html
<ion-row>
<ion-col col-6>
<ion-grid radio-group formControlName="location">
<ion-row>
<ion-col col-12>
<ion-item *ngFor="let l of locations;let index = index">
<ion-label class="custom-radio">
<ion-radio value="{{index}}"></ion-radio>
<i class="{{l.icon}}"></i><br/> {{l.description}}
</ion-label>
</ion-item>
</ion-col>
</ion-row>
</ion-grid>
</ion-col>
<ion-col col-6>
//other part
</ion-col>
</ion-row>
Then it looks like below.
Can you tell me how to design it looks like image 1?
If you can post your HTML and CSS, then I'd be happy to help with your actual code. However, in principle, you can do something like this;
HTML
<div class="ion-item">
<i class="l-icon"></i>
<span class="l-description">Text below the image</span>
</div>
CSS
.ion-item {
vertical-align: top;
display: inline-block;
text-align: center;
width: 60px;
}
.l-icon {
width: 50px;
height: 50px;
}
.l-description {
display: block;
}

Can't change background of ionic side menu

I am trying to apply some CSS to the background of an ionic side menu. My CSS is very simple:
.my-menu-item {
background-color: blue !important;
color: white !important
}
I have applied this style to ion-content, ion-list, ion-item, and ion-side-menu. And never do any of the menu items get a blue background.
Is there a way to do this? If so how?
Here is my html code:
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="header-text"> <!-- removed bar-stable -->
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="left">
<button class="button button-icon button-clear" menu-toggle="left">
<i class="icon header-bar-icon ion-navicon"></i>
</button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<button class="button button-icon button-clear" ng-click="shareAnywhere()">
<i class="icon header-bar-icon ion-ios-upload-outline"></i>
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu class="my-menu-item" side="left">
<ion-header-bar class="bar-stable">
<h1 id="menu-heading">MENU</h1>
</ion-header-bar>
<ion-content class="my-menu-item">
<ion-list class="my-menu-item">
<ion-item class="my-menu-item" menu-close href="#/app/discover">
<span class="menu-style">DISCOVER MOVIES</span>
</ion-item>
<ion-item class="my-menu-item" menu-close href="#/app/watchlist">
WATCH LIST
</ion-item>
<ion-item class="my-menu-item" menu-close href="#/app/home">
TUTORIAL
</ion-item>
<ion-item class="my-menu-item" menu-close href="#/app/friends">
FRIENDS
</ion-item>
<!--
<ion-item class="item-icon-right" nav-clear menu-close href="#/app/test">
TEST
</ion-item>
-->
<ion-item class="my-menu-item" menu-close href="#/app/news">
NEWS
</ion-item>
<ion-item class="my-menu-item" menu-close href="#/app/settings">
SETTINGS
</ion-item>
<ion-item class="my-menu-item" menu-close ng-click="logoutUser()">
SIGN OUT
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
You don't need to use some "span"s inside ion-item elements.
But you need to apply your styles to the ion-item > a elements.
Here's some pieces of code from one of my projects:
<ion-content>
<ion-list>
<ion-item ui-sref=".c1" ui-sref-active="active">1. Y</ion-item>
<ion-item ui-sref=".c2" ui-sref-active="active">2. O</ion-item>
<ion-item ui-sref=".c3" ui-sref-active="active">3. D</ion-item>
<ion-item ui-sref=".c4" ui-sref-active="active">4. N</ion-item>
</ion-list>
</ion-content>
And the SASS (here I'm overriding the background-color of the "active" ion-item's child (a element))
ion-list {
ion-item {
&.active a {
background-color: $darkYellow !important;
color: #fff;
}
}
}
Or in CSS: (assuming that you added the class coloredList to your ion-list)
ion-list.coloredList ion-item.active a {
background-color: red !important;
}
With the modified HTML, in order not to color ALL the ion-lists.
<ion-list class="coloredList"> ... </ion-list>