While reviewing angular interview question and answers, I noticed that the author has written the controller's syntax as follows:
function Customer($scope)
{
$scope.CustomerName = "Shiv";
$scope.CustomerCode = "1001";
$scope.Add = function () {
}
$scope.Update = function () {
}
}
I'm accustom to writing controllers in this way:
app.controller('Customer', function($scope) {
$scope.CustomerName = "Shiv";
$scope.CustomerCode = "1001";
$scope.Add = function () {}
$scope.Update = function () {}
});
How would I use the authors controller syntax in an angular project???