加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular1.5使用ui.select2

发布时间:2020-12-17 09:30:42 所属栏目:安全 来源:网络整理
导读:必须下载安装 ui.select2 select2(多选) module中配置 ui.select2 1、 主界面 控制器中定义了name变量 div {{$ctrl.name}} select-component hero="$ctrl.name"/select-component/div 2、 子界面component app.component("selectComponent",{ restrict: 'E'

必须下载安装 ui.select2 select2(多选)
module中配置 ui.select2
1、 主界面 控制器中定义了name变量

<div>
    {{$ctrl.name}}
    <select-component hero="$ctrl.name"></select-component>
</div>

2、 子界面component

app.component("selectComponent",{
    restrict: 'E',bindings: {
        hero: '='
    },templateUrl: './select.html',controller: SelectController
});

3、子界面controller

class SelectController {
    constructor() {
        "ngInject";
        // 初始化选择的值为空
        this.hero = "";
        this.groupSetup = {
            multiple: true,formatSearching: '查询内容',formatNoMatches: '请选择'
        };
    }
}

4、子界面

<select ui-select2="$ctrl.groupSetup" ng-model="$ctrl.hero" data-placeholder="选择" multiple="multiple">
    <option value=""></option>
    <option value="one">First</option>
    <option value="two">Second</option>
    <option value="three">Third</option>
</select>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读