I can print out all the ng-show values, but I can't filter out what I want.
I don't know if it's a regular expression error or an angularjs. I tried it directly in the developer tools and the result is successful.
Please check the full code in codepen, thanks
var thList = $('thead').find('th');
var fieldPattern = /\'(.*)\'.*\|.*/g;
var allTableField = [];
var valueList = [];
angular.forEach(thList, function(th) {
var value = $(th).attr('ng-show');
console.log(value);
if (/showField/g.test(value)) {
valueList.push(value);
var results = fieldPattern.exec(value);
if (results) {
allTableField.push(results[1]);
}
}
});
Sorry, my English is terrible and difficult to express.
I want to get ng-show values through JQ and filter out values that match regular expressions.
In the end, I only got part of it.