This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 234763 - Incomplete code completion
Summary: Incomplete code completion
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: AngularJS (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-22 08:21 UTC by Vladimir Riha
Modified: 2014-02-04 09:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (32.32 KB, text/plain)
2013-08-22 08:21 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2013-08-22 08:21:38 UTC
Created attachment 139044 [details]
IDE log

Please try this:


file.JS:
function Ctrl($scope) {
    $scope.page = 1;
    $scope.printAttempt = {
        number: 1,
        total: 2
    }
    $scope.print= function() {
    };
}
function Ctrl2($scope) {
    $scope.foo = 1;
}



index.html:
<div>
    <h1>{{name}}</h1>{{lastName}}
    Name: <input type="text" ng-model="pr"/>
</div>



=> in index.html, invoke cc for the ng-model attribute after "pr" => printAttempt is not offered, now finish it like

<input type="text" ng-model="print"/>

and again invoke cc

=> printAttempt is offered now


Product Version: NetBeans IDE Dev (Build 201308212300)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b55
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b40
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Petr Pisl 2013-08-22 12:19:17 UTC
The index.html page should contain definition of the controller. When I extend the index.thml to

<div ng-controller="Ctrl">
    <h1>{{name}}</h1>{{lastName}}
    Name: <input type="text" ng-model="pr"/>
</div>

then ti works as expected. I'm closing for now as invalid, but please reopen, if the condition are different than I'm expecting.
Comment 2 Vladimir Riha 2013-08-22 13:05:58 UTC
But the ng-controller is not required, please have a look at [1]. One benefit of this is that you can clearly see which route is handled by which controller (see [2] for instance - of course this is just use case and it says nothing about how common it is).

Please notice the last case in the description. If you have

<input type="text" ng-model="print"/>

and invoke cc after "print|", printAttempt is offered. Could it be offered from the beginning then?

I can't tell if ng-controller or $routeProvider way is more often in "real world". If you think it is more of a feature request, please feel free to change it.


[1] http://docs.angularjs.org/tutorial/step_07
[2] http://services.netbeans.org/synergy/client/app/js/app.js
Comment 3 Petr Pisl 2014-02-04 09:27:42 UTC
This should work in NB 8.0. Recognizing controllers in app.js via "when" method implemented.