Reputation: 579
I saw a demo of Netbeans 8 showing javascript autocompletion for AngularJS objects. In my test project, its not working. It get autocompletion on directives when i type in "ng-" but when i try to access the variables from a property object from a controller for example, the autocomplete isn't working. My project can be downloaded from http://www.clearsoftinc.com/public_html/. As an example, if you load this project into netbeans and then go to index.html and go to line 28. The "name" in the "product.name" expression should come up in autocomplete and it doesn't.
Upvotes: 0
Views: 1178
Reputation: 5876
The problem is you use the "controller as" feature, new in Angular 1.2. However this is not supported in NetBeans right now.
If you want to get the code completion, your ng-controller
directives should look like
ng-controller="StoreController"
and all the properties that should be exposed to the page would have to be defined via $scope
app.controller("StoreController", ["$scope", function($scope) {
$scope.products = gems;
}]);
Note that this is (afaik) not an obsolete or even hacky way, it is 100% valid and correct code. With Angular 1.2, it is up to you if you want to use $scope
or this
Update: Support for controller as
is now part of NetBeans daily builds (download here) and will be in upcoming NetBeans 8.1
Upvotes: 4