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 251909 - AngularJS EDI, the "best" way of coding controller for minify is not supported. I show sample code
Summary: AngularJS EDI, the "best" way of coding controller for minify is not support...
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: AngularJS (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Roman Svitanic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-17 10:32 UTC by lassve
Modified: 2015-04-29 09:20 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lassve 2015-04-17 10:32:37 UTC
(function() {
    
    var OrdersController = function ($scope, $routeParams, customersFactory) {
        var customerId = $routeParams.customerId;
        $scope.customer = null;
        $scope.allbeers = [{name:'heineken'},{name:'grolsch'}];//testdata
        
        function init() {
             customersFactory.getCustomer(customerId)
                .success(function(customer) {
                    $scope.customer = customer;
                    

                })
                .error(function(data, status, headers, config) {
                    //handle error
                });
        }        

        init();
    };
    
    OrdersController.$inject = ['$scope', '$routeParams', 'customersFactory'];

    angular.module('customersApp')
      .controller('OrdersController', OrdersController);
      
     

    
}());

 angular.module('customersApp', []).
  controller('OrdersController', function($scope) {
   $scope.allbeers = [{name:'heineken'},{name:'grolsch'}];   
  });
------------------------------------------------
Product Version = NetBeans IDE 8.0.2 (Build 201411181905)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0_25
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.25-b02
Comment 1 lassve 2015-04-17 10:39:42 UTC
Sorry bad sample, new sample

(function() {
    
    var AllOrdersController = function ($scope, customersFactory) {
        $scope.orders = null;
        $scope.ordersTotal = 0.0;
        $scope.totalType;
        
        function init() {
             customersFactory.getOrders()
                .success(function(orders) {
                    $scope.orders = orders;
                    getOrdersTotal();
                })
                .error(function(data, status, headers, config) {
                    //handle error
                });
        }        
        
        function getOrdersTotal() {
            var total = 0;
            for (var i=0,len=$scope.orders.length;i<len;i++) {
                total += $scope.orders[i].total;
            }
            $scope.ordersTotal = total;
            $scope.totalType = ($scope.ordersTotal > 100) ? 'success' : 'danger';
        }

        init();
    };
    
    AllOrdersController.$inject = ['$scope', 'customersFactory'];

    angular.module('customersApp')
      .controller('AllOrdersController', AllOrdersController);
    
}());
Comment 2 Vladimir Riha 2015-04-28 10:21:22 UTC
Reproducible, works if the controller is declared as function declaration (even in IIFE) but when declared as function expression


Product Version: NetBeans IDE Dev (Build 201504240001)
Java: 1.8.0_40; Java HotSpot(TM) Client VM 25.40-b25
Runtime: Java(TM) SE Runtime Environment 1.8.0_40-b25
System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)
Comment 3 Roman Svitanic 2015-04-28 15:22:11 UTC
Changeset: b39bfa25cb77
Author:    Roman Svitanic <rsvitanic@netbeans.org>
Date:      2015-04-28 17:21
Message:   #251909: No CC for AngularJS when controller function is assigned to a variable in IIFE - fixed
Comment 4 Quality Engineering 2015-04-29 02:31:40 UTC
Integrated into 'main-silver', will be available in build *201504290001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b39bfa25cb77
User: Roman Svitanic <rsvitanic@netbeans.org>
Log: #251909: No CC for AngularJS when controller function is assigned to a variable in IIFE - fixed
Task #251909 - AngularJS  EDI, the "best" way of coding controller for minify is not supported. I show sample code
Comment 5 lassve 2015-04-29 09:14:55 UTC
Thanks :)