Webstorm 10 Code Completion not working with AngularJS controllerAs syntax
I have posted about this in stackoverflow as well:
http://stackoverflow.com/questions/29987049/webstorm-10-code-completion-not-working-with-angularjs-controlleras-syntax
In short, I used the "Generating an AngularJS Application Stub" approach to generate an AngularJS app. I updated the bower.json to angular 1.3.x then ran "npm install". Everything installs and runs just fine. However, the code completion is not working as expected.
I modified the example view1.js file and set the controllerAs property when defining the route.
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/view1', {
templateUrl: 'view1/view1.html',
controller: 'View1Ctrl',
controllerAs: 'vm'
});
}])
.controller('View1Ctrl', [function() {
var vm = this;
vm.hello = 'Hello World';
}]);
<p>This is the partial for view 1.</p><div>{{vm.hello}}</div>I get a squiggly line under vm and a “unresolved variable or type” warning. I've seen a pluralsight example where doing something like this works in theory. I already tried adding angular and angular route to the javascript library in settings, but it didn't help.
The app runs/works as expected ("Hello World" shows up at runtime),it's just the code-completion doesn't appear to be working properly.I'm using WebStorm 10.0.2, any suggestions would be very much appreciated. Thanks!
Please sign in to leave a comment.
+1 - I'd love to see better support for controllerAs syntax in templates
please follow https://youtrack.jetbrains.com/issue/WEB-20676 for updates
Note that
{{vm.hello}}is resolved in 2016.3.2, but no proper completion/navigation is provided