I have an array of objects. The only exposed interface of these objects are their methods.
obj = {
getId : function() { ... },
getName : function() { ... },
getAvgHours : function() { ... }
}
In fact, there are some fields that contain the actual values. But these are generated code so these fields are cryptically named, are buried under another layer of field. The access to their values should be done via supplied functions only.
I'm looking for something like below, but it doesn't work:
<tr ng-repeat="p in people | orderBy:p.getAvgHours()">
I could add a named function getAvgHours(p) { return p.getAvgHours(); } to the scope, which works. But it seems redundant, and I'd need to add a dozen of these functions.
Is there any better way?