What are the differences in angular controller notation?

↘锁芯ラ 提交于 2019-12-02 03:04:36

问题


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:


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

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

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


来源:https://stackoverflow.com/questions/17977082/what-are-the-differences-in-angular-controller-notation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!