You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
There is a mistake in the documentation about the orders of the parameters. It says ...
Comparator which is used in determining if the expected value (from the filter
expression) and actual value (from the object in the array) should be considered a
match.
Can be one of:
function(expected, actual): The function will be given the object value and the
predicate value to compare and should return true if the item should be included in
filtered result.
Actually, when I tried it's the opposite: function(actual, expected) not function(expected, actual)
Example from plunkr:
=== index.html ===
<!DOCTYPE html><htmlng-app="plunker"><head><metacharset="utf-8" /><title>AngularJS Plunker</title><script>document.write('<base href="'+document.location+'" />');</script><linkrel="stylesheet" href="style.css" /><scriptdata-require="angular.js@1.2.4" src="http://code.angularjs.org/1.2.4/angular.js" data-semver="1.2.4"></script><scriptsrc="app.js"></script></head><bodyng-controller="MainCtrl">
List:
<png-repeat="item in list | filter:basicfilter:basiccomparator">- {{item.test}}</p></body></html>
\```
=== index.html ===
=== app.js ===
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.list = [{"test":"#1 - Actual from list"}, {"test": "#2 - Actual 2 from list"}];
$scope.basicfilter = {
$ : '',
test : 'Expected Value from Filter'
};
$scope.basiccomparator = function(expected, actual) {
console.log('Expected from filter: ', expected);
console.log('Actual from list :', actual);
return true;
}
});
=== app.js ===
The text was updated successfully, but these errors were encountered:
There is a mistake in the documentation about the orders of the parameters. It says ...
Actually, when I tried it's the opposite: function(actual, expected) not function(expected, actual)
Example from plunkr:
=== index.html ===
The text was updated successfully, but these errors were encountered: