Multiple check-box selection and create a tag base

2019-09-21 05:25发布

I want to provide multiple selection using check-box and depending on that it will create a tag using angular directive. If user selects multiple check-box then according to that tags should create and if user remove any tag then check-box should be unchecked. So depending on a selection and a removal of tag data should be filter out.

Here is my Working CODE

Thanks in Advance.!

2条回答
【Aperson】
2楼-- · 2019-09-21 06:12

Sounds like you are looking for some pre-built code.

You can use Angular-multi-select in combination with a custom filter.

查看更多
我命由我不由天
3楼-- · 2019-09-21 06:19

//FILTER

  .filter('findobj', function () {
 return function (dataobj, multipleVlaue) {
     if (!multipleVlaue) return dataobj;
     return dataobj.filter(function (news) {
         var tofilter = [];

         angular.forEach(multipleVlaue,function(v,i){ 
          tofilter.push(v);
         });

         return news.CategoryList.some(function (category) {
        return tofilter.indexOf(category.DisplayName)>-1;
     });

     });
 };
 })

Here u can refer the Solution

查看更多
登录 后发表回答