VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angularjs-ng-init-directive/

⇱ AngularJS ng-init Directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

AngularJS ng-init Directive

Last Updated : 28 Jul, 2022

The ng-init Directive is used to initialize AngularJS Application data. It defines the initial value for an AngularJS application and assigns values to the variables. The ng-init directive defines initial values and variables for an AngularJS application.

Syntax:

<element ng-init = "expression">
 ...
</element>

Example: This example describes the ng-init Directive by initializing an array of strings. 

Output:

👁 Image
 

Example 2: The example describes the ng-init Directive by specifying the object with its properties & associated value of it.

Output:

👁 Image
 
Comment

Explore