只允许一个在angularJS标签输入框标记输入框、只允许、标记、标签

2023-09-13 03:50:14 作者:温酒

我的工作角度,我创建了一个自动完成标签框。它的工作完美的,但需要量是,用户只能选择一个标签,但在我的情况越来越多选择的每日新闻。我的code如下。

 < D​​IV>         <标签输入NG模型=标签显示属性=姓名>         <自动完成源=loadTags($查询)占位符=开始输入最小长度=0去抖延迟=0>< /自动完成>         < /标签输入>         &所述p为H.;型号:{{代码}}&下; / P>        <按钮类=按钮NG点击=GetAllProjectByKeyId(searchKeyword.key)>搜索和LT; /按钮>    < / DIV> 

解决方案

在文档页面: HTTP ://mbenford.github.io/ngTagsInput/documentation/api

使用AngularJS开发我们下一款Web应用的七个理由

您可以看到你可以设定最高-标签属性:

 <标签输入NG模型=标签显示属性=姓名MAX-标签=1> 

I am working in angular, I have created a autocomplete tag box. its working perfect but requirment is, user can select only one tag but in my case multiple tages are getting selected. My code is below.

 <div>
         <tags-input ng-model="tags" display-property="name">

         <auto-complete source="loadTags($query)" placeholder="Start typing"  min-length="0" debounce-delay="0"></auto-complete>

         </tags-input>

         <p>Model: {{tags}}</p>

        <button class="Button" ng-click="GetAllProjectByKeyId(searchKeyword.key)">Search</button>
    </div> 

解决方案

On the documentation page: http://mbenford.github.io/ngTagsInput/documentation/api

You can see you can set a max-tags property:

<tags-input ng-model="tags" display-property="name" max-tags="1">

 
精彩推荐
图片推荐