npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ion-back-button-tabs

v2.2.0

Published

Advanced ion-back-button component.

Downloads

6

Readme

Advanced ion-back-button component

Use the ion-back-button-tabs component instead of ion-back-button when you got trouble navigating from a tabbed-page to a global-page and back. Live Demo For a complete demo project, an alternative workaround and a problem description look here.

Getting Started

1. Install

npm i ion-back-button-tabs --save

2. Import BackButtonTabsModule to your page module (shortened here)

import { BackButtonTabsModule } from 'ion-back-button-tabs';

@NgModule({
  imports: [BackButtonTabsModule]
})

3. Get attributes for ion-back-button-tabs

  • tabsPrefix is the url path set for the TabsPage component (e.g. 'tabs')

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { TabsPage } from './tabs.page';

const routes: Routes = [
  {
    path: 'tabs',
    component: TabsPage,
    children: [
      {
        path: 'tab1',
        children: [
          {
            path: '',
            loadChildren: '../tab1/tab1.module#Tab1PageModule'
          }
        ]
      },
      {
        path: 'tab2',
...
  • tabsPageSelector is the selector of the TabsPage component (e.g. 'app-tabs')

import { Component } from '@angular/core';

@Component({
  selector: 'app-tabs',
  templateUrl: 'tabs.page.html',
  styleUrls: ['tabs.page.scss']
})
export class TabsPage {}

4. Use ion-back-button-tabs in template

<ion-header>
  <ion-toolbar>
    <ion-buttons slot="start">

      <ion-back-button-tabs 
        defaultHref="/tabs/tab1" 
        tabsPrefix="tabs" 
        tabsPageSelector="app-tabs">
      </ion-back-button-tabs>
      
    </ion-buttons>
    <ion-title>Global Page</ion-title>
  </ion-toolbar>
</ion-header>

How it works

ion-back-button-tabs uses the ion-back-button internally. There are two attributes added (tabsPrefix + tabsPageSelector) which are used in the also added directive (ionBackButtonTabs).

<ion-back-button
    [defaultHref]="defaultHref"
    [tabsPrefix]="tabsPrefix"
    [tabsPageSelector]="tabsPageSelector"
    ionBackButtonTabs>
</ion-back-button>

The ionBackButtonTabs directive looks pretty much the same as the ion-back-button directive, except that it takes the correct route when navigating from a global-page to a tabbed-page. This means that it's first checked with the help of the tabsPrefix if to navigate back to a tabbed-page. If this is the case, the last active tab-route is determined with the help of the tabsPageSelector. For the determination, the StackController of the ion-tabs component view, which is located in the component view of the specified tabsPageSelector, is taken. Nevertheless, this is not a complete clean solution because currently private attributes of the current IonRouterOutlet are used. The location attribute to get the current ViewContainerRef, which is needed to find the component views. And some more to support swipe gestures.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Authors