javascript - AngularJS filtering by code -


i'm working angularjs. how can search code? current implementation searches ever type: id , name, city, code... how can search code?

app.js:

var app = angular.module('stack', []);  app.directive('filterlist', function ($timeout) {     return {         link: function (scope, element, attrs) {              var td = array.prototype.slice.call(element[0].children);              function filterby(value) {                 td.foreach(function (el) {                     el.classname = el.textcontent.tolowercase().indexof(value.tolowercase()) !== -1 ? '' : 'ng-hide';                 });             }              scope.$watch(attrs.filterlist, function (newval, oldval) {                 if (newval !== oldval) {                     filterby(newval);                 }             });         }     }; }); 

example on jsfiddle

    var app = angular.module('stack', []);      app.directive('filterlist', function ($timeout) {         return {             link: function (scope, element, attrs) {                  var td = array.prototype.slice.call(element[0].children);                  function filterby(value) {                     td.foreach(function (el) {                         el.classname = el.cells[3].textcontent.tolowercase().indexof(value.tolowercase()) !== -1 ? '' : 'ng-hide';                     });                 }                  scope.$watch(attrs.filterlist, function (newval, oldval) {                     if (newval !== oldval) {                         filterby(newval);                     }                 });             }         };     }); 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -