AngularJs filtering data based on option selection and tag creation based on selection

爱⌒轻易说出口 提交于 2019-12-01 13:09:11

问题


Here is my code : Jsfiddle

  1. Initialy its should display all the data.

  2. I'm able to add new tags and based on tag selection data is filtering but data should be added below the existing filtered data if new tag is selected and data should be removed if tag is deleted.


回答1:


finally Everything is resolved.

//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 : CODE



来源:https://stackoverflow.com/questions/31655104/angularjs-filtering-data-based-on-option-selection-and-tag-creation-based-on-sel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!