How does AngularJS recognize a function as controller directive -
i looking @ angular api reference. says ngcontroller directive, , give next example:
function settingscontroller($scope) { $scope.name = "john smith"; }
this looks plain javascript function, argument $scope passed in. thought define directives, need call:
app.directive("name", func())
does angular treats function $scope argument controller directive? or if modify dom element include ng-controller = "settingscontroller" settingscontroller interpreted such?
ngcontroller
directive (directives referred in dom--angular allows specify directives via tag names, attributes, class names , comments). ngcontroller
directive written create controller instance based on name passed in directive (in case string "settingscontroller"
. function not directive.
angularjs angularjs-directive
No comments:
Post a Comment