How does AngularJS recognize a function as controller directive

I am looking at Angular API reference. It says that ngController is a directive, and give the following example:

function SettingsController($scope) {
 $scope.name = "John Smith";
}

This looks exactly like a plain Javascript function, with argument $scope passed in. I thought to define directives, we need to call:

app.directive("name", func())

Does Angular treats any function with $scope argument as controller directive? Or only if we modify DOM element to include ng-controller = "SettingsController" that SettingsController will be interpreted as such?

ngController is the directive (directives are always referred to in the DOM--Angular allows you to specify directives via tag names, attributes, class names and comments). The ngController directive is written so that it will create a controller instance based on the name that is passed in to the directive (in this case the string "SettingsController". The function itself is not a directive.