angular / angular-hint

run-time hinting for AngularJS applications
362 stars 45 forks source link

Warn for orderBy getting called function in template #46

Open jeffbcross opened 9 years ago

jeffbcross commented 9 years ago

I've seen apps that don't realize that orderBy is supposed to be given a reference to a getter function, rather than calling the function directly. But there are advanced cases where assigning the result of a function to orderBy is warranted, so a little "are you sure?" nudge would be helpful.

Bad:

<li ng-repeat="item in items | orderBy:getItemLabel()"></li>

Good:

<li ng-repeat="item in items | orderBy:getItemLabel"></li>

Acceptable Advanced Usage:

<li ng-repeat="item in items | orderBy:getSortPropertyName()"></li>