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

ngx-tab-router

v0.0.6

Published

[![Build Status](https://travis-ci.org/imanshu15/ngx-tab-router.svg?branch=master)](https://travis-ci.org/imanshu15/ngx-tab-router) [![NpmVersion](https://img.shields.io/npm/v/ngx-tab-router.svg)](https://www.npmjs.com/package/ngx-tab-router) [![Downloads

Downloads

36

Readme

Tab Routing for Angular (NgxTabRouter)

Build Status NpmVersion Downloads Fork

An angular package for routing throughout the application using tabs,

  • Open component in a new tab dynamically
  • Search a component to open

You can find the demo here NgxTabRouterDemo Or the stackblitz example here Stackblitz Demo

Installation

Install using npm,

$ npm install ngx-tab-router --save

Dependencies,

$ npm install @ng-bootstrap/ng-bootstrap
$ npm install bootstrap
$ npm install jquery

After installing above dependencies, add following refrences to the angular.json file.

   {
       ...
       "styles": [
         ...
         "node_modules/bootstrap/dist/css/bootstrap.min.css"
       ],
       "scripts": [
         ...
         "node_modules/jquery/dist/jquery.min.js",
         "node_modules/bootstrap/dist/js/bootstrap.min.js"
       ]
   }

Usage

Import

Add NgxTabRouterModule to your module file: Also add NgbModule for bootstrap.

declarations: [
    ..., // your components
    TestOneComponent,
    TestTwoComponent
],
imports: [
    ... , //your modules
    NgbModule,
    NgxTabRouterModule.forRoot({
       components: [ 
        {key: 'one', component: TestOneComponent, title: 'Component 1'},
        {key: 'two', component: TestTwoComponent, title: 'Component 2'}
      ],
      initialComponents : [ // set initial router tab
        {tabKey: 'one'}
      ],
      reloadOnTabChange: false
    })
],
 entryComponents: [ TestOneComponent, TestTwoComponent] // add router components to the entryComponents

Add <ngx-tab-router> to your app.component file:

   <ngx-tab-router> </ngx-tab-router>

Example

Refer to main app in this repository for working example. Or this Stackblitz Demo

First you have to install the ngx-tab-router and the dependencies above mentioned. Then add the mentioned references to angular.json file. After that import NgbModule and NgxTabRouterModule in your module file. In NgxTabRouterModule.forRoot() method pass config the components.

After configuration you can either inject NgxTabRouterService in to a component and call openTab(tabKey: string) as following,

  constructor(private tabService: NgxTabRouterService) { }

  openTabOne() {
    this.tabService.openTab('one'); 
    // this will open component configed with key 'one' in a new tab
  }

Or you can use the built in component search using keys CTRL + R, which will let you type and enter the component key and it will open relevent component in a new tab.

Passing data to tab component

when you open the tab using openTab method you can pass a data object,

  constructor(private tabService: NgxTabRouterService) { }

  openTabOne() {
    this.tabService.openTab('one', { id: 1, name: 'imanshu'});
    // here you can pass a data object
  }

In your component you just have to add a property called data,

 export class TestComponent implements OnInit {
 
  public data: any; // define this, this will contain the data object you pass

  constructor() {
  }

  ngOnInit() {
    console.log('Data', this.data);
    // you can see { id: 1, name: 'imanshu'} here
  }
}

Development

Want to contribute?

  • Fork repository.
  • Update ./projects/ngx-tab-router
  • Build & Test the library.
  • Update ./src/app with new functionality.
  • Update README.md accordingly.
  • Pull request.
Instructions
  • Download or clone the repository.
  • Install dependencies $ npm install
  • Start the app $ npm start
  • Build the app $ npm run build or $ ng build
  • Build the library after change run either $ npm run package or $ ng build NgxTabRouter

verify app is working after $ npm start ,

http://localhost:4200

License

MIT Free Software