如何在 Angular 6 中使用 select2? [英] How to use select2 in Angular 6?

查看:24
本文介绍了如何在 Angular 6 中使用 select2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 angular 6 中使用select2"来自动完成.谁以前用过?,请帮帮我.

I need to use "select2" in angular 6 for autocomplete. Who's ever use it before? , help me please.

推荐答案

以防万一其他人来到这里.Select2 有很多角度包装器的分支,但它们都很大,并且还需要 JQuery (1.32MB) 和 Select2 (839kB).

Just in case anyone else landed here. There are lots of forks of angular wrappers for Select2 but they all sizeable and also require both JQuery (1.32MB) and Select2 (839kB).

如果您对没有任何依赖项的纯 Angular 的 Select2 的简化克隆感兴趣,您可以尝试这个:

If you are interested in a simplified clone of Select2 in pure angular without any dependencies you could try this one:

https://github.com/timbophillips/angular-components-workspace/tree/master/projects/filtered-select

https://www.npmjs.com/package/filtered-select

花里胡哨要少得多,但就我而言,我真的只想要可搜索的选择控件.

Far fewer bells and whistles but for my purposes I really just want the searchable select control.

将其安装为 npm 模块 (16.2kB) 或使用源代码.它在没有 Ivy 的情况下编译,所以它应该适用于旧的和新的 angular 项目.

Install it as an npm module (16.2kB) or use the source code. Its compiled without Ivy so it should work on old and new angular projects.

这篇关于如何在 Angular 6 中使用 select2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆