[![npm version](https://badge.fury.io/js/%40ng-select%2Fng-select.svg)](https://badge.fury.io/js/%40ng-select%2Fng-select)
[![Coverage Status][coveralls-image]][coveralls-url]
[![gzip bundle size](http://img.badgesize.io/https://unpkg.com/@ng-select/ng-select@latest/bundles/ng-select-ng-select.umd.min.js?compression=gzip&style=flat-square)][ng-select-url]
[coveralls-image]: https://coveralls.io/repos/github/ng-select/ng-select/badge.svg?branch=master
[coveralls-url]: https://coveralls.io/github/ng-select/ng-select?branch=master
[ng-select-url]: https://unpkg.com/@ng-select/ng-select@latest
# Angular ng-select - Lightweight all in one UI Select, Multiselect and Autocomplete
See [Demo](https://ng-select.github.io/ng-select) page.
---
## Versions
| Angular| ng-select|
| ------|:------:|
| >=9.0.0 <10.0.0 | v4.x |
| >=8.0.0 <9.0.0 | v3.x |
| >=6.0.0 <8.0.0 | v2.x |
| v5.x.x | v1.x |
---
perf(pencil): remove graphiteWidth option
BREAKING CHANGE: The graphiteWidth option has been removed.
The default graphite width of 10mm is always used for performance reasons.
Table of contents
=================
* [Features](#features)
* [Getting started](#getting-started)
* [API](#api)
* [Change detection](#change-detection)
* [Custom styles](#custom-styles)
* [Validation state](#validation-state)
* [Contributing](#contributing)
* [Development](#development)
* [Inspiration](#inspiration)
## Features
- [x] Custom binding to property or object
- [x] Custom option, label, header and footer templates
- [x] Virtual Scroll support with large data sets (>5000 items).
- [x] Infinite scroll
- [x] Keyboard navigation
- [x] Multiselect
- [x] Flexible autocomplete with client/server filtering
- [x] Custom search
- [x] Custom tags
- [x] Append to
- [x] Group items
- [x] Output events
- [x] Accessibility
- [x] Good base functionality test coverage
- [x] Themes
## Warning
Library is under active development and may have API breaking changes for subsequent major versions after 1.0.0.
## Getting started
### Step 1: Install `ng-select`:
#### NPM
```shell
npm install --save @ng-select/ng-select
```
#### YARN
```shell
yarn add @ng-select/ng-select
```
### Step 2: Import the NgSelectModule and angular FormsModule module:
```js
import { NgSelectModule } from '@ng-select/ng-select';
import { FormsModule } from '@angular/forms';
@NgModule({
declarations: [AppComponent],
imports: [NgSelectModule, FormsModule],
bootstrap: [AppComponent]
})
export class AppModule {}
```
### Step 3: Include a theme:
To allow customization and theming, `ng-select` bundle includes only generic styles that are necessary for correct layout and positioning. To get full look of the control, include one of the themes in your application. If you're using the Angular CLI, you can add this to your `styles.scss` or include it in `.angular-cli.json` (Angular v5 and below) or `angular.json` (Angular v6 onwards).
```scss
@import "~@ng-select/ng-select/themes/default.theme.css";
// ... or
@import "~@ng-select/ng-select/themes/material.theme.css";
```
### Step 4 (Optional): Configuration
You can also set global configuration and localization messages by injecting NgSelectConfig service,
typically in your root component, and customize the values of its properties in order to provide default values.
```js
constructor(private config: NgSelectConfig) {
this.config.notFoundText = 'Custom not found';
this.config.appendTo = 'body';
// set the bindValue to global config when you use the same
// bindValue in most of the place.
// You can also override bindValue for the specified template
// by defining `bindValue` as property
// Eg : <ng-select bindValue="some-new-value"></ng-select>
this.config.bindValue = 'value';
}
```
### SystemJS
If you are using SystemJS, you should also adjust your configuration to point to the UMD bundle.
In your systemjs config file, `map` needs to tell the System loader where to look for `ng-select`:
```js
map: {
'@ng-select/ng-select': 'node_modules/@ng-select/ng-select/bundles/ng-select.umd.js',
}
```
## API
### Inputs
| Input | Type | Default | Required | Description |
| ------------- | ------------- | ------------- | ------------- | ------------- |
| [addTag] | `boolean \| ((term: string) => any \| Promise<any>)` | `false` | no | Allows to create custom options. |
| addTagText | `string` | `Add item` | no | Set custom text when using tagging |
| appearance | `string` | `underline` | no | Allows to select dropdown appearance. Set to `outline` to add border instead of underline (applies only to Material theme) |
| appendTo | `string` | null | no | Append dropdown to body or any other element using css selector. For correct positioning `body` should have `position:relative` |
| bindValue | `string` | `-` | no | Object property to use for selected model. By default binds to whole object. |
| bindLabel | `string` | `label` | no | Object property to use for label. Default `label` |
| [closeOnSelect] | `boolean` | true | no | Whether to close the menu when a value is selected |
| clearAllText | `string` | `Clear all` | no | Set custom text for clear all icon title |
| [clearable] | `boolean` | `true` | no | Allow to clear selected value. Default `true`|
| [clearOnBackspace] | `boolean` | `true` | no | Clear selected values one by one when clicking backspace. Default `true`|
| [compareWith] | `(a: any, b: any) => boolean` | `(a, b) => a === b` | no | A function to compare the option values with the selected values. The first argument is a value from an option. The second is a value from the selection(model). A boolean should be returned. |
| dropdownPosition | `bottom` \| `top` \| `auto` | `auto` | no | Set the dropdown position on open |
| [groupBy] | `string` \| `Function` | null | no | Allow to group items by key or function expression |
| [groupValue] | `(groupKey: string, cildren: any[]) => Object` | - | no | Function expression to provide group value |
| [selectableGroup] | `boolean` | false | no | Allow to select group when groupBy is used |
| [selectableGroupAsModel] | `boolean` | true | no | Indicates whether to select all children or group itself |
| [items] | `Array<any>` | `[]` | yes | Items array |
| [loading] | `boolean` | `-` | no | You can set the loading state from the outside (e.g. async items loading) |
| loadingText | `string` | `Loading...` | no | Set custom text when for loading items |
| labelForId | `string` | `-` | no | Id to associate control with label. |
| [markFirst] | `boolean` | `true` | no | Marks first item as focused when opening/filtering. |
| [isOpen] | `boolean` | `-` | no | Allows manual control of dropdown opening and closing. `True` - won't close. `False` - won't open. |
| maxSelectedItems | `number` | none | no | When multiple = true, allows to set a limit number of selection. |
| [hideSelected] | `boolean` | `false` | no | Allows to hide selected items. |
| [multiple] | `boolean` | `false` | no | Allows to select multiple items. |
| notFoundText | `string` | `No items found` | no | Set custom text when filter returns empty result |
| placeholder | `string` | `-` | no | Placeholder text. |
| [searchable] | `boolean` | `true` | no | Allow to search for value. Default `true`|
| [readonly] | `boolean` | `false` | no | Set ng-select as readonly. Mostly used with reactive forms. |
| [searchFn] | `(term: string, item: any) => boolean` | `null` | no | Allow to filter by custom search function |
| [searchWhileComposing] | `boolean` | `true` | no | Whether items should be filtered while composition started |
| [trackByFn] | `(item: any) => any` | `null` | no | Provide custom trackBy function |
| [clearSearchOnAdd] | `boolean` | `true` | no | Clears search input when item is selected. Default `true`. Default `false` when **closeOnSelect** is `false` |
| [editableSearchTerm] | `boolean` | `false` | no | Allow to edit search query if option selected. Default `fa
没有合适的资源?快使用搜索试试~ 我知道了~
select angular package
共233个文件
ts:90个
scss:51个
html:50个
需积分: 0 0 下载量 131 浏览量
2023-07-13
17:39:04
上传
评论
收藏 456KB ZIP 举报
温馨提示
select angular package
资源推荐
资源详情
资源评论
收起资源包目录
select angular package (233个子文件)
browserslist 429B
styles.css 764B
.editorconfig 427B
.gitignore 103B
ng-select.component.html 7KB
forms-custom-template-example.component.html 3KB
forms-with-options-example.component.html 1KB
forms-async-data-example.component.html 1KB
group-selectable-example.component.html 1KB
forms-single-select-example.component.html 1KB
template-option-example.component.html 1KB
index.html 890B
append-to-example.component.html 876B
template-display-example.component.html 841B
output-events-example.component.html 835B
multi-select-custom-example.component.html 810B
virtual-scroll-example.component.html 756B
multi-checkbox-example.component.html 748B
forms-multi-select-example.component.html 716B
multi-checkbox-group-example.component.html 697B
group-function-example.component.html 681B
multi-select-template-example.component.html 673B
template-optgroup-example.component.html 652B
search-autocomplete-example.component.html 651B
template-header-footer-example.component.html 641B
multi-select-limit-example.component.html 617B
group-children-example.component.html 592B
stackblitz-button.component.html 582B
multi-select-default-example.component.html 568B
data-source-options-example.component.html 547B
example-viewer.component.html 547B
group-selectable-hidden-example.component.html 542B
search-editable-example.component.html 474B
app.component.html 465B
group-default-example.component.html 437B
data-source-array-example.component.html 435B
data-source-backend-example.component.html 421B
tags-backend-example.component.html 412B
dropdown-position-example.component.html 387B
multi-select-disabled-example.component.html 380B
search-custom-example.component.html 373B
template-loading-example.component.html 364B
template-search-example.component.html 353B
tags-custom-example.component.html 347B
template-label-example.component.html 310B
bindings-nested-example.component.html 305B
bindings-default-example.component.html 284B
search-default-example.component.html 279B
multi-select-hidden-example.component.html 276B
bindings-custom-example.component.html 258B
tags-default-example.component.html 249B
index.html 228B
tags-closed-dropdown-example.component.html 212B
route-viewer.component.html 122B
favicon.ico 5KB
karma.conf.js 1KB
karma.conf.js 1KB
angular.json 5KB
package.json 3KB
angular.json 2KB
tslint.json 2KB
package.json 644B
tsconfig.json 634B
tsconfig.lib.json 569B
tsconfig.lib.json 529B
tsconfig.spec.json 262B
package.json 256B
tslint.json 247B
tslint.json 247B
tsconfig.spec.json 242B
tsconfig.app.json 224B
ng-package.json 165B
ng-package.json 154B
LICENSE 1KB
yarn.lock 524KB
CHANGELOG.md 72KB
README.md 14KB
README.md 1KB
bug_report.md 926B
CONTRIBUTING.md 679B
feature_request.md 560B
thor.png 25KB
spidey.png 18KB
batman.png 14KB
angular.png 2KB
material.theme.scss 10KB
default.theme.scss 10KB
ant.design.theme.scss 10KB
ng-select.component.scss 6KB
_sidebar.scss 2KB
styles.scss 1KB
template-loading-example.component.scss 1KB
_content.scss 120B
append-to-example.component.scss 105B
_mixins.scss 70B
output-events-example.component.scss 0B
group-selectable-hidden-example.component.scss 0B
tags-closed-dropdown-example.component.scss 0B
multi-select-default-example.component.scss 0B
data-source-backend-example.component.scss 0B
共 233 条
- 1
- 2
- 3
资源评论
jack_lua
- 粉丝: 5
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 主流的前端开发框架的简介
- 基于Java Swing + MySQL的图书管理系统
- 基于python tkinter的图书馆管理系统
- vmware虚拟机安装教程 (2)vmware虚拟机安装教程 (2)vmware虚拟机vmware虚拟机安装教程 (2).txt
- c语言文件读写操作代码c语言文件读写操作代码c语言文件读写操作代码c语言文件读写操作代码
- 商用手机+oai+open5gs配置文件
- 22计应专3王国长22206510201318.zip
- Spring Boot开发教程的主要步骤和要点
- linux常用命令大全linux常用命令大全linux常用命令大全linux常用命令大全.txt
- 扫雷c++小程序,修改了一些地方,好多printf()用于查看调试,可以删除,easyx是辅助小代码,安装一下,12张图片
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功