Javatpoint Logo
Javatpoint Logo

AngularJS ng-controller Directive

The AngularJS ng-controller directive adds a controller class to the view (your application). It is the key aspect which specifies the principles behind the Model-View-Controller design pattern.

It facilitates you to write code and make functions and variables, which will be parts of an object, available inside the current HTML element. This object is called scope.

This is supported by all HTML elements.

Syntax:

Parameter explanation:

expression: It specifies the name of the controller.

Let's take an example to demonstrate ng-controller directive.

See this example:

Test it Now



Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA