NOTE: This is a WebStorm issue, not an angular.js issue.
Screencast of the problem: http://f.cl.ly/items/302s0d1k1i3i1B2p0W09/ws703-angular-not-defined.mp4
Descr
To make WebStorm (2016+) properly recognize angularjs and even enable code completion, simply go to:
File > Settings
Then on the left, select:
Languages & Frameworks > JavaScript > Libraries
Mark the checkbox next to 'angular' and click Apply. If angular does not appear in the list, you will need to click 'Add' and browse to wherever you have the library downloaded.