Monday, July 17, 2017

What is ng-init directive?

Ng-init directive used to initialize application data. Sometimes you may require some local data for your application, this can be done with the ng-init directive.  

How to use ng-init directive  

In this example, we are going to create a variable called “Name” using ng-directive and display the value of variable on the page.


Output:





In above example, we initialized variable of string. These variable can be used anywhere inside <div> elememt.  

No comments:

Post a Comment