AngularJS : minification issue in directive

前端 未结 2 556
广开言路
广开言路 2020-12-28 13:23

I have yet another issue with minification. This time it\'s because of the $scope service passed to the directive\'s controller. See below code:

angular.modu         


        
2条回答
  •  鱼传尺愫
    2020-12-28 14:00

    ok, I ended up creating the controller in a separate file :

    angular.module('person.controllers').controller('personCtrl', ['$scope', function ($scope) {
    $scope.test = 3;
    }]);
    

    then in the directive, I assign the controller by name:

    controller: 'personCtrl'
    

    Not sure it's the best way. It looks clean though. What do you think ?

提交回复
热议问题