角度控制器符号有什么区别? [英] What are the differences in angular controller notation?
本文介绍了角度控制器符号有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我见过一些以 angular 初始化控制器的符号,它们是:
I've have seen a couple of notations to initialize a controller in angular, those are:
app.controller('nameCtrl', function($scope, ... ){})
和
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?
推荐答案
app.controller('nameCtrl', function($scope, ... ){})
以上不适用于缩小,但以下适用.
The above won't work with minification, but the below will.
app.controller('nameCtrl', ['$scope','...',function($scope,...){}])
这篇关于角度控制器符号有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文