← BYTES
AngularJS·Starter·Ref: 5.1.17

What does the ng-init directive do?

Have a question about this video? Mention reference 5.1.17 when you contact us.

a.It is the required first directive in any AngularJS app
b.It evaluates an expression in the current scope at initialization time, typically used to set up small amounts of local data
c.It initializes a database connection
d.It starts the digest cycle for the very first time
ng-init="x = 5" runs the given expression once when the element is compiled -- it's mostly used for small demo/test setup, since real application initialization logic is better placed in a controller.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES5117#AngularJS