hideBackButton attribute hides the menuToggle button too - ionic2

The Problem
I push the Root Page to Page2 that supports a side menu, the issue is that when it opens Page2 it shows the back button and hides the menu button for that I've tried to add hideBackButton to Page2 in order to see the menu button but I both the back button and menu button disappeared!
Here is my current code:
<ion-navbar hideBackButton>
<button menuToggle start>
<ion-icon name="menu"></ion-icon>
</button>
</ion-navbar>
The expected behavior should be:
Should hide the back button, and show the menu button.
Ionic Version:
Ionic2

You can't do that following that way; however what you can do is to do a setRoot instead of pushing from the root to Page2

You can use following instead of your code:
<ion-toolbar hideBackButton>
<button menuToggle start>
<ion-icon name="menu"></ion-icon>
</button>
</ion-toolbar>

If you don't want to allow the "back" action on your Page2, and since you face a problem hiding the button, why not removing your root page from the history stack before accessing your Page2?
In such a case, the "back" action not gonna be allowed and the "back" button not gonna be displayed too.
About how to remove a page from the history stack before pushing another page, you could have a look at:
Remove a view from the back history - Ionic2

Related

adding a "navigate Back" and "navigate Forward" buttons in django templates

I want to add a btn in my navbar.html in django-templates, and every time client clicks it, he navigates to page previous to what he in on, and also "naviaget Forward" if clicked other button.
how can i do it?
You can use JS:
<button onclick="history.back()">Go Back</button>
<button onclick="history.forward()">Go Forward</button>

How to handle a CSS property of clicked object in Ember?

Tell me please, how to handle onclick action by ID. For example, i’ve something in hbs template:
<button id="myButton" {{action "myAction"}} >OK</button>
it has CSS:
button {color: "red";}
How to do two things by onclick action:
1. Set property to clicked object (only to clicked), eg to set CSS colour “green”,
2. Get some property of clicked (eg CSS colour), and console log or alert.
Thanks in advance!
You can connect the action to the "onclick" event of the button like this
<button id="myButton" onclick={{action "myAction"}} >OK</button>
And then the first argument of the action will be the click event, from which you can take the target DOM element.
Check out this example twiddle:
https://ember-twiddle.com/1d14560e0e979dbbdddbfee57c84601c?openFiles=templates.application.hbs%2C

Navigated automatically to wrong page after clicking in a button

I am newbie in ionic2, I have made a list of events with sliding Edit and Delete buttons. I have wanted to view the event details page by tapping on the row and it works fine. But if I tap on the edit button, the edit page appears and immediately replaced by event detail page. My code is following:
<ion-list>
<ion-item-sliding *ngFor="let event of eventList" (click)='goToEventDetail(event.id)'>
<ion-item><p><strong>{{event?.eventName}}</strong><p>
<p>Place: <strong>{{event?.place}}</strong></p>
<p>Date: <strong >{{event?.date}}</strong></p>
</ion-item>
<ion-item-options>
<button ion-button color="primary" (click)="goToEditEventDetail(event.id)"><ion-icon name='clipboard'></ion-icon> Edit</button>
<button ion-button color="danger" (click)="removeEvent(event.id)"><ion-icon name='trash'></ion-icon> Delete</button>
</ion-item-options>
</ion-item-sliding >
I have tried by removing "(click)='goToEventDetail(event.id)" event from "ion-item-sliding", in that case I have got expected result. My finding is, after clicking to edit button it fires "goToEditEventDetail" event and after that it also fires "goToEventDetail". I need to stop firing the second event, is there any solution? Thanks in advance.

Ionic 3 - Extract the side menu in it's own component

I need to build a scalable menu for an ionic 2/3 app (preferably using ion-menu). Following the guides on the docs the menu should be a sibling of the main content and they suggest to keep it inside app.html, which is a very high place inside the app that doesn't have to be crowded too much.
If we have a big menu or if we need to use several different menus, triggered by actions inside app, this place is not appropriate for this purpose.
I want to hide the complexity of the menu in it's own container/component and handle the logic outside app.component.ts.
app.html should stay slim and a construction like the one below may be useful.
<app-menu></app-menu> // this should be the enclosing container of the menu logic
<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>
If I do this, the following error comes up:
Menu: must have a [content] element to listen for drag events on. Example:
<ion-menu [content]="content"></ion-menu>
<ion-nav #content></ion-nav>
Any thoughts on how to implement this, avoiding to add code directly to app.html and app.component.ts?
Tks
error code just tells you to write <ion-nav #content></ion-nav> if you use <ion-menu [content]="content"></ion-menu>...
example toggle menu code below ...
<ion-header>
<ion-navbar color="danger">
<ion-buttons start>
<button ion-button icon-only menuToggle>
<ion-icon name="menu">
</ion-icon>
</button>
</ion-buttons>
</ion-navbar>
<ion-menu [content]="content">
<ion-content padding>
this is awkmal
</ion-content>
</ion-menu>
</ion-header>
<ion-nav #content></ion-nav>

Show spinner next to navigation link when clicked

Say I have a few links in my navigation:
...
{{#linkTo 'projects.trending' tagName="li"}}
<a href="#" {{bindAttr href="view.href"}}> Trending projects</a>
{{/linkTo}}
{{#linkTo 'projects.all' tagName="li"}}
<a href="#" {{bindAttr href="view.href"}}> All projects</a>
{{/linkTo}}
...
When I click one of these links, it will fetch data via Ajax and go to that route. But sometimes it takes a while to fetch the data, so I'd like to show a spinner. I currently already have a global spinner at the top of the page. It would be cool to show a spinner next to the navigation link that was clicked, so the user sees what page is currently loading.
What would be the best/easiest approach to implement this?
You could put a span next to each navigation link that's hidden by default, and contains the spinner. Then onClick, show the span. Hide all of them after ajax is done.