Skip to main content
AngularJS - Controllers

AngularJS - Controllers

Initialize view state and behavior with controllers and scope.

AngularJS - Controllers illustration

How it works

Controllers initialize state and expose view behavior, commonly through $scope in older applications. Avoid using controllers as global storage or service containers. Component-style controllers and controller-as patterns can make ownership clearer.

Practice checklist

  • Use examples that match the AngularJS version in the existing application.
  • Keep user input, asynchronous states, and failures visible and understandable.
  • Test keyboard access and validate important rules on the server.
  • Review dependency support and migration needs before production changes.

Further reading: Tutorialspoint: AngularJS - Controllers · Official AngularJS developer guide · Migration guide.