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

ng6-multiselect

v0.0.7

Published

Angular 6 bootstrap-style

Downloads

10

Readme

Angular6 Multiselect

Angular 6 bootstrap-style

Documentation

Getting Started

Installation

  • The Mutiselect Dropdown package is published on the npm Registry.

  • Install the package : npm install ng6-multiselect

  • Once installed import Ng6MultiSelectModule from the installed package into your module as follows:

Usage

Import Ng6MultiselectModule into NgModule in app.module.ts

import { NG6MultiselectModule } from 'ng6-multiselect';

@NgModule({
  // ...
  imports: [
    Ng6MultiselectModule,
  ]
  // ...
})

Declare the component data variables and options in your component where you want to consume the dropdown component.


import { Component} from '@angular/core';
import { NG6MultiselectModule } from 'ng6-multiselect';

export class AppComponent {
    emptyTitle="Select foods";
  selectedTitle="Food item(s) selected";
  data=[];
  displayData:any=[
    {id:"apple", itemName:"Apple", primaryGroup:"Fruit", secondaryGroup:"Tree Grown"},
    {id:"mango", itemName:"Mango", primaryGroup:"Fruit", secondaryGroup:"Tree Grown"},
    {id:"starfruit", itemName:"Starfruit", primaryGroup:"Fruit", secondaryGroup:"Tree Grown"},
    {id:"kiwi", itemName:"Kiwi", primaryGroup:"Fruit", secondaryGroup:"Vine Grown"},
    {id:"pineapple", itemName:"Pineapple", primaryGroup:"Fruit"},
    {id:"peach", itemName:"Peach", primaryGroup:"Fruit", secondaryGroup:"Tree Grown"},
    {id:"bannana", itemName:"Bannana", primaryGroup:"Fruit", secondaryGroup:"Tree Grown"},
    {id:"tomato", itemName:"Tomato", primaryGroup:"Fruit"},
    {id:"orange", itemName:"Orange", primaryGroup:"Fruit", secondaryGroup:"Tree Grown"},
    {id:"strawberry", itemName:"Strawberry", primaryGroup:"Fruit", secondaryGroup:"Berries"},
    {id:"cherry", itemName:"Cherry", primaryGroup:"Fruit", secondaryGroup:"Tree Grown"},
    {id:"raspberry", itemName:"Raspberry", primaryGroup:"Fruit", secondaryGroup:"Berries"},
    {id:"blackberry", itemName:"Blackberry", primaryGroup:"Fruit", secondaryGroup:"Berries"},
    {id:"blackBean", itemName:"Black Bean", primaryGroup:"Vegtable", secondaryGroup:"Legume"},
    {id:"soyBean", itemName:"Soy Bean", primaryGroup:"Vegtable", secondaryGroup:"Legume"},
    {id:"chickPeas", itemName:"Chickpeas", primaryGroup:"Vegtable", secondaryGroup:"Legume"},
    {id:"peanut", itemName:"Peanut", primaryGroup:"Vegtable", secondaryGroup:"Legume"},
    {id:"greenPeas", itemName:"Green Peas", primaryGroup:"Vegtable", secondaryGroup:"Legume"},
    {id:"lentils", itemName:"Lentils", primaryGroup:"Vegtable", secondaryGroup:"Legume"},
    {id:"artichoke", itemName:"Artichoke", primaryGroup:"Vegtable"},
    {id:"eggplant", itemName:"Eggplant", primaryGroup:"Vegtable"},
    {id:"asparagus", itemName:"Asperagus", primaryGroup:"Vegtable"},
    {id:"broccoli", itemName:"Broccoli", primaryGroup:"Vegtable"},
    {id:"brusselsSprouts", itemName:"Brussels Sprouts", primaryGroup:"Vegtable"},
    {id:"cabbage", itemName:"Cabbage", primaryGroup:"Vegtable"},
    {id:"cauliflower", itemName:"Eggplant", primaryGroup:"Vegtable"}
  ];
    
    constructor(){
    }
    onSelectChange(data:string[]){
        console.log(data);
    }

    onSelect(data:string[]){
        console.log(data);
    }

    onDeselect(data:string[]){
        console.log(data);
    }
}

Add the following component tag in you template

<ng6-multiselect
    [emptyTitle]="'Select foods'"
    [selectedTitle]="Food(s) selected"
    [data]="displayData" 
    [(ngModel)]="data" 
    (onSelectChange)="onSelectChange($event)" 
    (onDeselect)="onSelect($event)"
    (onDeselect)="onDeselect($event)"
    [(ngModel)]="data"
    (onSelectAll)="onSelectAll($event)"></ng6-multiselect>

Callback Methods

All callback methods return the data that is in the multiselect as a string array of id's

  • onSelect - Triggered when a element is selected, on its own or in a group Example : (onSelect)="onItemSelect($event)"
  • onDeselect - Triggered when a element is deselected, on its own or in a group Example : (onDeselect)="OnItemDeselect($event)"
  • onSelectChange - Triggered when a element is selected or deselected, on its own or in a group Example : (onSelectChange)="onSelectChange($event)"

Run locally

  • Clone the repository or downlod the .zip,.tar files.
  • Run npm install
  • Run ng serve for a dev server
  • Navigate to http://localhost:4200/ The app will automatically reload if you change any of the source files.

License

LGPL-3.0 License.