相关疑难解决方法(0)

在AngularJS中声明控制器

我在AngularJS教程中看到过,有些人声明他们的控制器函数是这样的:

function FirstController($scrope) {
    // do something with $scope
}
Run Code Online (Sandbox Code Playgroud)

和其他人这样做:

var FirstController = function ($scope) {
    // do something with scope
}
Run Code Online (Sandbox Code Playgroud)

哪种方式是在JS文件中声明控制器的最佳方式,哪种方式最适合使用最新版本的AngularJS(现在为1.0.7),哪种方法最佳?或者它真的不重要吗?

javascript function angularjs

11
推荐指数
1
解决办法
7154
查看次数

标签 统计

angularjs ×1

function ×1

javascript ×1