zmbq
zmbq

Reputation: 39013

Debugging Angular front-ends

We are working on a relatively simple Angular front-end (version 1.4x), and we're constantly battling very small bugs caused by typos. For example, we get data from the server and then put it in the scope:

...
$scope.result = data.results
...

See the plural there? This code just works, putting undefined in $scope.result. We would like to get some sort of warning of notification when this happens. Static analysis tools such as JSLint can't help us there, because they have absolutely no way of knowing what the server returns.

This problem manifests itself again in HTML templates:

...
<p>The result is: <emph>{{results}}</emph></p>
...

Here, too, we get no notification whatsoever we tried accessing an undefined property.

Is there a way to get any kind of notification for this? We find ourselves spending a lot of time on these bugs.

Upvotes: 3

Views: 92

Answers (1)

Michael Hobbs
Michael Hobbs

Reputation: 1693

WebStorm will handle these sorts of issue for you. For example in my code {{f.$error}} I placed an extra r on the end and WS flags this a both a misspelling and Unresolved variable $errorr. WebStorm does an execlent job of handling many different frame works to include Angular and Node.

Upvotes: 1

Related Questions