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

scania-angular-select2

v1.0.0

Published

AngularJS directive for <a href="https://github.com/ivaynberg/select2">Select2</a><br/>

Downloads

1

Readme

scania-angular-select2 Join the chat at https://gitter.im/scania-bootstrap/scania-angular-select2

AngularJS directive for Select2

Scania-angular-select2 directive gives you a customizable select box with support for searching, tagging, ng-model, ng-repeat, native HTML select and option tags, infinite scrolling, and many other highly used options. See select2 API documentationfor the list of options

###Demo

Getting Started

##Requirements Scania Corporate UI Select2 V3.5.2 Underscore JQuery

Installation

 bower install scania-angular-select2
 npm install

#Usage

Add the following script to your index.html file and you are good to go :

<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
<link href="bower_components/scania-angular-ui/css/corporate-ui-sc-select.css">
<link rel="stylesheet" href="bower_components/select2/select2.css"/><br/>
<link href="bower_components/scania-angular-ui/css/corporate-ui-sc-select.css">
<link rel="stylesheet" href="node_modules/corporate-ui/dist/css/corporate-ui.css">

<script type="text/javascript" src="bower_components/jquery/jquery.js"></script>
<script type="text/javascript" src="bower_components/underscore/underscore.js"></script>
<script src="bower_components/select2/select2.js"></script>
 <script src="bower_components/scania-angular-ui/src/scania-angular-select2.js"></script>

Don't forget to copy the following images to your app root.

     select2.png
     select2x2.png
     select2-spinner.gif

Next inject the directive into your app

angular.module('yourapp', ['scania.angular.select2']);

##Required Atributes

The following attributes are required on a select tag

       id="your component id"<br/>
       class="sc-multiselect"<br/>
       sc-select2 (scania-angular-select2 directive)

A complete example can be found here

Examples

Single select with Auto Tokenization

    <input type="text" id="single-select-tagging" style="width: 100%"
           data-placeholder="Type to add a tag"
           data-create-search-choice="vm.createSearchChoice"
           data-item-id="id"
           data-label="name"
           data="{{vm.items}}"
           ng-model="vm.selectedItemForSingleTokkenization"
           sc-input-select/>

Single select with default item selected

 <select ng-options="item as item.name for item in vm.items track by item.id"
         id="my-single3" style="width: 100%"
         data-placeholder="Select Item"
         ng-model="vm.selectedItem"
         data-value="id"
         sc-single-select>
 </select>

Single select with a custom container css class

<select id="my-single7" style="width: 100%"
        data-placeholder="With custom container css"
        data-container-css-class="container-css-class"
        sc-single-select>
    <option ng-bind="options.placeholder"></option>
    <option ng-repeat="item in vm.items" ng-model="item">
        {{item.name}}
    </option>
</select>

Simple Multiselect

<select id="my-multi1" style="width: 100%" multiple="multiple"
        data-placeholder="Select Items"
        sc-multi-select>
    <option ng-repeat="item in vm.items" ng-selected="item.selected" ng-model="item">
        {{item.name}}
    </option>
</select>

Multiselect with ng-change event listener and default selection

<select ng-options="item as item.name for item in vm.items track by item.id"
    ng-change="vm.selectionChanged()"
    ng-model="vm.selectedItems"
    data-value="id"
    id="my-multi3" style="width: 100%"
    multiple="multiple"
    data-placeholder="With ng-chnage"
    data-container-css-class="select-all"
    sc-multi-select>
</select>