AngularJS template: unresolved function or method orderBy()

Dear all!

I have the following code in my AngularJS application:

<div ng-repeat="item in items | orderBy:'name' ">

Now, Webstorm Inspection complains about orderBy:
"unresolved function or method orderBy()"

Does Webstorm not know of AngularJS orderBy? How could I solve this issue?

If I choose "suppress for statement" Webstorm does the following, which is obviously wrong :-)
<div ng-repeat="//noinspection JSUnresolvedFunction item in items | orderBy:'name' ">


Thanks for your help!

Michael

6 comments

Works fine to me in WebStorm 8.0.1 (AngularJS plugin v. 135.565). Do you have angular.js (uncompressed) in your project?

0

Hi Elena!

This is strange... I also have WebStorm 8.0.1 and AngularJS plugin v. 135.565.

Even in the most simple project the orderBy function is not recognized in ng-repeat elements.
I have included AngularJS 1.2.9 (uncompressed) in my html. I also added this file as a JavaScript library (via Settings -> JavaScript -> Libraries).

Do you have any idea how i could solve this?

As a workaround, is there an option how i could tell Webstorm Inspector to ignore the following line?
<div ng-repeat="item in items | orderBy:'name' ">


Thanks for your help!
Michael

0

I have the same versions of plugin and Webstorm, and orderBy is correctly resolved for me - see attached screenshot. Can you try composing a sample project that shows up the issue?

You can't suppress the inspection for this fragment only - you have to either disable it completely or create a custom scope (with your HTML excluded) and enable inspection for this scope only. See http://www.jetbrains.com/webstorm/webhelp/configuring-inspection-for-different-scopes.html for more info



Attachment(s):
orderBy.png
0

Hi Elena!

Here's a fresh project.

As you can see in the screenshot, "filter" is recognized but "orderBy" is not recognized.

Do you have the same behaviour when you open the project?

Cheers
Michael



Attachment(s):
angular-project.zip
screenshot.png
0

Yes, I can recreate the issue using your project. We are using different Angular.js versions. Try replacing yours with the attached one - should help



Attachment(s):
angular.js
0

Please sign in to leave a comment.