【发布时间】:2014-08-29 08:11:13
【问题描述】:
我使用数组注入设置了我的控制器,但是随着我传递给控制器的服务数量的增加,我将重复每个服务两次 - 在数组中并作为参数。
我从下面的问题Injecting a service into another service in angularJS 发现我不必使用数组注入,这意味着没有重复,但它会导致缩小问题。然而,正如 John Ledbetter 评论的那样,如果使用 ngmin,这不是问题。
我的问题是,如果我使用以下定义:
appControllers.controller('LoginController', function($scope, $rootScope, $localStorage, myService1, myService2) {
代替:
appControllers.controller('LoginController', [ '$scope', '$rootScope', '$localStorage', 'myService1', 'myService2',
function($scope, $rootScope, $localStorage, myService1, myService2) {
在使用 grunt 进行缩小时,除了需要使用 ngmin 之外,还有什么其他含义吗?
【问题讨论】:
标签: javascript angularjs