什么是角控制器符号的区别是什么? [英] What are the differences in angular controller notation?

查看:175
本文介绍了什么是角控制器符号的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过一对夫妇的符号来初始化角控制器,这些是:

  app.controller('nameCtrl',函数($范围,...){})

  app.controller('nameCtrl',['$范围','...',函数($范围,...){}])

这两个工作,但我找不到文档中的任何现货的差异,它甚至关系呢?


解决方案

  app.controller('nameCtrl',函数($范围,...){})

以上不会缩小工作,但将在下面。

  app.controller('nameCtrl',['$范围','...',函数($范围,...){}])

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?

解决方案

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

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

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

这篇关于什么是角控制器符号的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆