I attempted to implement a string match function using case-insensitive matching with my input variable, $scope.search, but unfortunately it did not yield the desired results.
<input type="text" ng-model="search" autofocus="autofocus">
angular.forEach(groups, function(group, key) {
console.log(group); // => Object contains
if (group.label.match(/($scope.search)/i)) {
result[key] = group;
}
});
The data object group looks like this:
Object { label: "Transfiguration", articles: Array[1] }
Is there a proper way to use group.label.match() with $scope.search? Any help would be greatly appreciated. Thank you!