Ionic 2+ How to access parent navController

There could potentially be scenarios when you will have something like this

Each of ion-nav components have their own NavController, when you try to push or pop a view, depending on the inheritance level of your ion-nav , the view will be pushed or popped from the view stack of the related NavController

Now there could be instances where you want to say set a Root page that would go under the parent Nav, This is how you would do it

Firstly we will import the App and NavController components in the Child component as shown below, both of these can be found under ionic-angular module

import { App, NavController } from 'ionic-angular';

Let’s say you want to make SettingsPage as your Application root, You will first import it like this,

then make sure that this exists in entryComponents and declarations arrays under app.module.ts file as shown below (if )

now we will provide the instance of App to your child component as shown below

Its now easy to get hold of NavController for the parent and set our SettingsPage as root, as shown below

OR

You can also pass on SettingsPage as a string value in case you want to stick with Lazy loading (give that the page has its own IonicPageModule), this method does not need you to add entries in entryComponents and declarations arrays under app.module.ts

This should work

There could potentially be another way, feel free to leave another method if you know any or if you find any issues with above approach.

Hope this helps

Cheers

 

PHP: Check if Start of each word in a sentence is uppercase or any part of a word is UPPERCASE

When working with strings, occasionally we would want to check if any part of a word is uppercase or start of a word is an uppercase letter. This post provide a generic function that can be extended to match your needs. For this post I will use … [Continue reading]

How to convert a string to equivalent integer value based on ASCII codes in Javascript

Hi Guys, Here is a quick tip if you would like to convert a string into a sum of ASCII codes for all characters Function you can use For ES5: [crayon-599dd7bf1528d513710875/] We can do equivalent in ES6 … [Continue reading]

Hunspell with PHP on Windows – Part 1

Ok so I hear you saying, how the hell can I use Hunspell and PHP with Windows, Now the way I am going to show you isn't the only way but is a much simpler way without compiling and using binaries. What is Hunspell? Well I can re-write what's … [Continue reading]

PHP Start of the day and End of the day for a timezone Util functions

This is a quick post where I am sharing a couple of functions to calculate start of a given day and end of the day for a given timezone Start of the day [crayon-599dd7bf160ba471302387/] End of the … [Continue reading]

[Solved] bootbox.js show ajax html data inside the dialog

Hi Guys Just a quick one here if you are using a library called bootbox.js in your project. This library does not make ajax request automatically if you wish to load some data from your server to show within your dialog window. Instead, you can do … [Continue reading]

Project Data Sources: re-sync required – Upgrading to PhpStorm 10.0.2

Hey Guys, While I upgraded to PHPStorm 10.0.2 and restarted it, I got this message at the top right corner of this IDE Project Data Sources: re-sync required Unsupported format version 2.2 - (2.4 expected) While that got me puzzled for a … [Continue reading]

How to get Pinterest Numeric Board ID

Get Pinterest Numerci board ID

Hi Guys, It used to be easy to get Pinterest board ID before, but for some reason they have buried that sort of information within source, A while back I wrote something that wouldn't use the Pinterest official/unofficial API but parse the HTML … [Continue reading]

Free Clock Animation GIFs

Clock animation 15 minute interval

Hi Guys, While I was working on a project I need a couple of GIFs for Clock animations. I came up with these. You can use it in your commercial or free websites etc. Attribution or link to this page would be appreciated though :) Here are a … [Continue reading]

Unzip files in bulk in their own directory (sh)

Here is a quiz tip to unzip several zip files found in a directory to their own directories. Use this command from the folder where zip files are to be found [crayon-599dd7bf17341876255520/] To make sure that output folders will be created … [Continue reading]