Here is a code snippet I am working with:
<input type="text" ng-model="filteredText">
<ul>
<li ng-repeat="item in data | filter: {Name : filteredText}">
</li>
</ul>
Initially, when the Name property is static, everything functions correctly. However, I now require the ability to filter by a dynamic field. For example:
<ul>
<li ng-repeat="item in data | filter: {propertyName: filteredText}">
</li>
</ul>
In this scenario, the propertyName is dynamic and is sourced from the $scope
. Unfortunately, using this dynamic value in the filter
directive does not yield the desired result.