Javatpoint Logo
Javatpoint Logo

AngularJS ng-init Directive

The AngularJS ng-init directive facilitates you to evaluate the given expression in the current scope. Ng-controller is preferred over ng-init because the ng-init directive can add some unnecessary logic into the scope.

It is supported by all HTML elements.

Syntax:

Parameter explanation:

expression: It specifies an expression to evaluate.

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

See this example:

Test it Now




Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA