0 votes
in Angular by
How Can We Initialize Angular Application Data?

1 Answer

0 votes
by

We can use ng-init directive to achieve the same. You can see in the below example we have used ng-init directive to initialize the pi value.

HTML
<body ng-app="myApp" ng-init="pi=3.14">
The value of pi is {{pi}}
</body>

Related questions

0 votes
asked Dec 29, 2023 in Angular by DavidAnderson
0 votes
asked Dec 31, 2023 in Angular by DavidAnderson
...