New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular2-select

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-select

Select component for Angular 2 (based on select2 JQuery plugin).

  • 1.0.0-alpha.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Angular 2 select component

A native select component for angular 2, based on the select2 JQuery plugin. The component is currently in alpha, so breaking changes are to be expected.

Install

npm install --save angular2-select

Configuration

Systemjs

In systemjs.config.js add angular2-select to map and package:

var map = {
	// others...,
	'angular2-select': 'node_modules/angular2-select'
};

var packages = {
	// others...,
	'angular2-select': {
		main: 'index.js',
		defaultExtension: 'js'
	}
};

Usage

To use the select components in one of your components, import the SELECT_DIRECTIVES with:

import {SELECT_DIRECTIVES} from 'angular2-select';

Add the following HTML to your component's template to include the select component:

<ng-select
	[options]="options">
</ng-select>

And add the SELECT_DIRECTIVES to the list of directives.

Within your component's class you can set the list of select options. This must be a list of objects, with for each object a value (option identifier) and a label (which the user sees in the select drop down).

export class YourComponent {

    options = [
		{
			value: 'a',
			label: 'Alpha'
		},
		{
			value: 'b',
			label: 'Beta'
		},
		{
			value: 'c',
			label: 'Gamma'
		}
	];
}

Parameters

Next to the obligatory options parameter, the ng-select tag supports the following optional parameters:

<ng-select
	[options]="options"
    placeholder="Select an option"
    allowClear="true"
    theme="default">
</ng-select>

The optional parameters can also be bound to a variable in the component's class.

<ng-select
	[options]="options"
    [placeholder]="placeholder"
    [allowClear]="canClearSelect"
    theme="default">
</ng-select>

export class YourComponent implements {

    placeholder: string = 'Select an option';
    canClearSelect: boolean = true;
    // ...
}

Optional parameters will be set to their default value if they are not defined in the ng-select tag.

placeholder

default: ''

The placeholder value is shown if no option is selected.

allowClear

default: 'false'

If set to true, a button with a cross that can be used to clear the currently selected option is shown if an option is selected.

theme

default: 'default'

Currently the original select2 CSS is used, which allows you to select between to themed looks, default and classic.

Not yet supported

Select2 features that are currently not supported are:

  • Tests
  • Option groups
  • Loading remote data
  • Disabled mode
  • Disabled results
  • Multiselect
    • Limit the number of selections
    • Tagging
  • Localization, RTL
  • Themes
  • Templates

Develop

Clone or fork the repository and run:

npm install
gulp build

IMPORTANT Building with gulp build currently only works with node version 6, due to an issue in one of gulp-typescript's dependencies (beautylog).

Keywords

FAQs

Package last updated on 25 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc