Is there a way to switch out the ionic2-super-tabs Toolbar for the ion-slides pager feature?

Hello there,

Currently, I am utilizing the following plugin in my Ionic 3 project: https://github.com/zyra/ionic2-super-tabs

The plugin offers a great functionality for swipeable tabs in Ionic applications. In its documentation, it demonstrates how to hide the toolbar (which I have successfully accomplished). Now, my aim is to replace the toolbar with an ion-slides type feature such as the pager, indicating to users that they can swipe left or right to navigate to other pages or tabs.

Below is the code snippet I am currently working with:

home.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

import { SuperTabsController } from 'ionic2-super-tabs';

import { TabsPage } from '../tabs/tabs';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  constructor(public navCtrl: NavController, private superTabsCtrl: SuperTabsController) {

  }

  welcomePage() {
    this.navCtrl.push(TabsPage,{index: "1"})
  }

  ionViewWillLeave() {
    this.superTabsCtrl.showToolbar(false);
}

}

tabs.ts

import { Component } from '@angular/core';
import { NavParams } from 'ionic-angular';

import { MyPage } from '../my/my';
import { WelcomePage } from '../welcome/welcome';
import { SettingsPage } from '../settings/settings';

@Component({
  templateUrl: 'tabs.html',
})
export class TabsPage {

  index = this.navParams.get('index')
  tab1Root = SettingsPage;
  tab2Root = WelcomePage;
  tab3Root = MyPage;

  constructor(public navParams: NavParams) {

    }


}

tabs.html

import { Component } from '@angular/core';
import { NavParams } from 'ionic-angular';

import { MyPage } from '../my/my';
import { WelcomePage } from '../welcome/welcome';
import { SettingsPage } from '../settings/settings';

@Component({
  templateUrl: 'tabs.html',
})
export class TabsPage {

  index = this.navParams.get('index')
  tab1Root = SettingsPage;
  tab2Root = WelcomePage;
  tab3Root = MyPage;

  constructor(public navParams: NavParams) {

    }


}

Moreover, I would like to incorporate a navigation display feature similar to this: https://i.sstatic.net/pZ8YC.png

Answer №1

Customize the page by adding a unique element alongside the <super-tabs> component.

Check out this sample code, adjust it to your needs, note that I haven't tested it:

HTML

  <super-tabs (tabSelect)="onTabSelect($event)" ...>
    ...
  </super-tabs>
  <div class="pager">
    <span class="pager-dot" [class.selected]="selectedTabIndex === 0"></span>
    <span class="pager-dot" [class.selected]="selectedTabIndex === 1"></span>
    <span class="pager-dot" [class.selected]="selectedTabIndex === 2"></span>
  </div>

TypeScript

@Component( ... )
export class MyPage {
  // initialize with default tab selection
  selectedTabIndex: number = 0;
  onTabSelect(ev: any) {
    // unsure of event properties, assume "ev" has an "index" attribute
     this.selectedTabIndex = ev.index;
  }
}

SCSS

.pager {
  position: fixed;
  bottom: 0;
  text-align: center;
  width: 100%;
  height: 15px;
  span.pager-dot {
    display: inline-block; // use for setting height + width of span
    width: 10px;
    height: 10px;
    border-radius: 500rem; // create round shape
    transition: all .3s linear; // smooth size transition

    &.selected {
      width: 15px;
      height: 15px;
    }
  }
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Encountering issues with Jest Setup in Next.js as it appears to unexpectedly include a React import in index.test.js

Hey there, I've been pondering over this issue for the past few days. It appears to be a common error with multiple solutions. I'm facing the dreaded: Jest encountered an unexpected token /__tests__/index.test.js:16 import React from "r ...

Calculating the subtotal amount using Vue.js is a straightforward process

My Vue.js project functions as a shopping cart, and I am looking to calculate the subtotal for each product row. Here is an excerpt of my HTML code: <div id="app"> <table border="1"> <thead> <tr> <th>#</th ...

What is the best way to retrieve all objects from this data model?

I am looking to collect all the Model Objects from the data structure provided below. const PRODUCTS = [ { brand: 'Audi', allSeries: { serie: 'A3', allModels: [ { model: ' ...

Can the concept of partial class be used in an AngularJS controller?

Is it possible to organize code into groups using partials in angularjs? The issue is that my controller has become too cluttered with a lot of code for different methods and functionalities, making it difficult to read. I want to maintain the same contro ...

Obtain identical encryption results with CryptoJS (JavaScript) and OpenSSL (PHP)

I am in the process of integrating a PHP encryption function into a ReactJS application. I have a requirement to transmit the token in a specific format that was generated using the OpenSSL library function (openssl_encrypt). It has been observed that the ...

Exploring the Various Path Options in Angular 2 Routing

As a newcomer to Angular and Node JS, I am currently working on an application and struggling with how to efficiently navigate between my different components. Users can input the name of a user and add books associated with them When clicking on a book ...

Display the HTML content retrieved from the SailsJS Controller

Exploring the world of SailsJS, I am on a mission to save HTML content in a database, retrieve it, and display it as rendered HTML. To achieve this goal, I have set up a sails model and a controller. This is what my model looks like: attributes: { ht ...

I need to link the click function to the li components within the xpages autocomplete feature

I've successfully implemented Tim Tripcony's advanced type-ahead solution and it's working well. However, I'd like to customize it a bit by redirecting the user to the selected document instead of filling the editbox with the selected d ...

Connect directly to the DOM without using an event

A jQuery function is included in my code: $('#big-bad-bold-button') .on('click', aloha.ui.command(aloha.ui.commands.bold)); This function binds the click event. Is there a way to achieve the same binding without requiring a click? ...

Having difficulty with closing a modal using v-model in VueJS

Upon pressing the button labeled Close, an error message appeared in the console as shown below: "Error: Cannot find module './undefined'" found in ---> <WhatsNew> at src/components/WhatsNew.vue Displayed below is the conten ...

Avoid mutating the prop directly and instead, utilize a data or computed property that is based on the value of the prop. The prop that is being mutated in this case is

Help me understand this issue that Vue is displaying, I am not sure what is going on. This is my progress element: <el-progress :percentage="percentCompleted" v-show="uploadingVideo"></el-progress> data() { return{ percentCompleted: 0 ...

Listcell XUL with button options

How can I make buttons inside a listcell function in XUL? I am having trouble getting it to work. Here is the XUL code: <listitem id = "1"> <listcell label = "OK Computer"/> <listcell label = "Radiohead"/> <listcell label ...

Creating a custom component in Angular 2 that includes several input fields is a valuable skill to have

I have successfully created a custom component in Angular 2 by implementing the CustomValueAccessor interface. This component, such as the Postcode component, consists of just one input field. <postcode label="Post Code" cssClass="form-control" formCon ...

Having trouble manipulating state in JavaScript for React Native?

Encountering an issue when attempting to use the setState function in React Native. Code Snippet import React from "react"; import { TextInput, Text, View, Button, Alert } from "react-native"; const UselessTextInput = () => { st ...

JavaScript Selenium code encountering an "Element not interactable" error with input textbox element

Currently, I am attempting to utilize Selenium in order to automate inputting a location into the search bar on weather.com. Initially, I wrote the code in Python and it seems to be functioning properly: // this works driver = webdriver.Chrome(ChromeDriver ...

Exclude basic authentication for a specific route

Using node, express and connect for a simple app with basic HTTP auth implemented. The code snippet below shows part of the implementation: var express = require('express'), connect = require('connect'); app.configure = function(){ ...

When trying to pass context to the interactive node shell, an error message may appear stating "TypeError: sandbox argument must be converted to a context"

I am trying to initiate an interactive node shell with pre-initialized objects. But when I use the code below, it gives me an error: var repl = require('repl') var x = 11, y = 21 var con = {} con.x = x con.y = y repl.start('> &apo ...

When using Vue.js and Quasar to implement multiple filtering forms, an issue arises where the input value disappears

I am currently exploring how to implement multi-item filtering in Quasar, a framework of Vue. At the moment, I am utilizing input and checkbox elements. Everything seems to be functioning correctly, but there is an issue with the select item disappearing. ...

Is there a way to adjust the timepicker value directly using the keyboard input?

Is there a way to control the material-ui-time-picker input using the keyboard instead of clicking on the clock? This is my current code: import React, { Component } from "react"; import { TimePicker } from "material-ui-time-picker"; import { Input as Ti ...

Incorrect data for minimal values within Google charts

Currently, I am utilizing a Google chart found at the following link: In my data set, I have significantly high values for the line chart and relatively low values for the bar chart. In order to make both types of data more easily readable, I would like t ...