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.


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


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA