AngularJS进阶(五)Angular实现下拉菜单多选

AngularJS进阶(五)Angular实现下拉菜单多选Angular实现下拉菜单多选写这篇文章时,引用文章地址如下:http://ngmodules.org/modules/angularjs-dropdown-multiselecthttp://dotansimha.github.io/angularjs-dropdown-multiselect/#/AngularJSDropdownMultiselectThisdire

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

Angular实现下拉菜单多选

写这篇文章时,引用文章地址如下:

http://ngmodules.org/modules/angularjs-dropdown-multiselect

http://dotansimha.github.io/angularjs-dropdown-multiselect/#/

AngularJS Dropdown Multiselect

This directive gives you a Bootstrap Dropdown with the power of AngularJS directives.

Features

Based on Bootstrap’s dropdown.

jQuery is not necessary.

Seperated your data and the selection data. no modification to the data made.

Built-in search.

Complete control on the selected items model to fit it to your requirements.

Two view options: normal list and checkboxes.

Pre-selected values.

Limit selection count.

Grouping items by property.

Callback events.

Demo

http://dotansimha.github.io/angularjs-dropdown-multiselect/

Dependencies

required: AngularJS >= 1.2, Lodash >= 2, Bootstrap >= 3.0

Make sure to add the dependencies before the directive’s js file.

Note: Bootstrap JS file is not needed for the directive, it just uses the CSS file.

Install

Download the files

Using bower:

Just run bower install angularjs-dropdown-multiselect

Manually: You can download the .js file directly or clone this repository.

Include the file in your app

<script type=”text/javascript” src=”angularjs-dropdown-multiselect.js”></script>.

You can also use the minfined version (angularjs-dropdown-multiselect.min.js).

Include the module in angular (i.e. in app.js) – angularjs-dropdown-multiselect

Usage and Documentation

See the documentation and examples in the GitHub pages: http://dotansimha.github.io/angularjs-dropdown-multiselect/

由以上英文文档可以得知,若使用angularjs-dropdown-multiselect,首先需要在index.html中引入AngularJS >= 1.2, Lodash >= 2, Bootstrap >= 3.0,如下所示:

<script src=“js/angularjs-dropdown-multiselect.js”></script>

<script src=“js/lodash.min.js”></script>

并在app.js模块中添加依赖angularjs-dropdown-multiselect。如下所示:

var routerApp = angular.module(‘routerApp’, [‘ui.router’‘ngCookies’‘ngTable’‘angularjs-dropdown-multiselect’‘MedListModule’]);

yh_set_dtl.html核心代码如下:

<div style=”float:left>优 惠 类 型:</div>

<!– Demo –>

<div ng-dropdown-multiselect=“” 

 options=“yhctlModelOptions” 

 selected-model=“yhctlModel”

 checkboxes=“true”>

</div>

controllers.js代码如下:

 $scope.yhctlModel = [];

 

 $scope.yhctlModelOptions = [ 

                              {id: 1, label: ‘限定用户’}, 

                              {id: 2, label: “限定商家”}, 

                              {id: 3, label: “限定使用次数”},

                              {id: 4, label: “限定药品”}, 

                              {id: 5, label: “与其它优惠共享”}];

效果图如下:

 AngularJS进阶(五)Angular实现下拉菜单多选

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/164218.html原文链接:https://javaforall.net

(0)
上一篇 2022年7月25日 上午10:00
下一篇 2022年7月25日 上午10:00


相关推荐

  • linux内核使用的编程语言_linux内核模块编程

    linux内核使用的编程语言_linux内核模块编程1、内核编程不能访问C库2、内核编程时必须使用GNUC3、内核编程时缺乏像用户空间那样的内存保护机制4、内核编程时浮点数很难使用5、内核只有一个很小的定长堆栈6、由于内核支持异步中断,抢占和SMP,因此必须时刻注意同步和并发7、要考虑可移植性的重要性

    2022年10月8日
    4
  • 国内首个OpenClaw中文版!当贝Molili 1.0.7上线:一键安装部署 成本减半

    国内首个OpenClaw中文版!当贝Molili 1.0.7上线:一键安装部署 成本减半

    2026年3月12日
    1
  • mybatis 面试题

    mybatis 面试题1.Mybatis比IBatis比较大的几个改进是什么a.有接口绑定,包括注解绑定sql和xml绑定Sql,b.动态sql由原来的节点配置变成OGNL表达式,c.在一对一,一对多的时候引进了association,在一对多的时候引入了collection节点,不过都是在resultMap里面配置2.什么是MyBatis

    2022年6月3日
    33
  • linux下发送邮件[通俗易懂]

    linux下发送邮件[通俗易懂]先安装一个mailxyuminstallmailx配置:126邮箱为例,自己去官网注册一个,在这里我注册了一个huangbaokangtest@126.com在/etc/mail.rc文件末尾加入如下配置setfrom=huangbaokangtest@126.comsetsmtp=smtp.126.comsetsmtp-auth-user=huangbaokangtes…

    2022年10月20日
    5
  • 游戏中的“垂直同步”与“三重缓冲”究竟是个啥?[通俗易懂]

    游戏中的“垂直同步”与“三重缓冲”究竟是个啥?[通俗易懂]从今天开始,我们会开启“小教程”的兄弟栏目——小科普,给大家介绍在配电脑或玩游戏过程中经常会遇到的专业名词。第一期“小科普”我们来讲讲游戏中经常会遇到的一个画面选项——垂直同步我们曾在一期语音里和大家讲探讨过垂直同步的功用,可惜语音有60秒的长度限制,并不能和大家解释清楚,那么今天就来详细分析一下“垂直同步”:它到底是干嘛用的?它有什么缺点吗?

    2022年5月11日
    143
  • pycharm windows 重置_pycharm重置设置,恢复默认设置「建议收藏」

    pycharm windows 重置_pycharm重置设置,恢复默认设置「建议收藏」备忘,备忘,备忘2020-03-23日更新,重置有问题的,请参考底部官网链接.(另外:喷我并不能解决你的问题.)window系统找到下方目录–>删除.再重新打开pycharm#WindowsVista,7,8,10:\Users\\.例:C:\Users\Administrator\.PyCharm2018.1#WindowsXP:\DocumentsandSett…

    2022年8月27日
    5

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号