在審查角度的採訪question and answers,我注意到,作者寫控制器的語法如下:角控制器語法
function Customer($scope)
{
$scope.CustomerName = "Shiv";
$scope.CustomerCode = "1001";
$scope.Add = function() {
}
$scope.Update = function() {
}
}
我習慣於寫控制器以這樣的方式
app.controller('Customer', function($scope) {
$scope.CustomerName = "Shiv";
$scope.CustomerCode = "1001";
$scope.Add = function() {}
$scope.Update = function() {}
});
我將如何在角度項目中使用作者控制器語法?