What are the differences in angular controller not

2020-04-16 01:38发布

I've have seen a couple of notations to initialize a controller in angular, those are:

app.controller('nameCtrl', function($scope, ... ){})

and

app.controller('nameCtrl', ['$scope','...',function($scope,...){}])

Both work, but I couldn't find anything in the documentation that spot the differences, does it even matter?

1条回答
倾城 Initia
2楼-- · 2020-04-16 02:04
app.controller('nameCtrl', function($scope, ... ){})

The above won't work with minification, but the below will.

app.controller('nameCtrl', ['$scope','...',function($scope,...){}])
查看更多
登录 后发表回答