YouTip LogoYouTip

Ng Ng Init

# AngularJS `ng-init` Directive [![Image 3: AngularJS Reference Manual](#) AngularJS Reference Manual](#) * * * ## AngularJS Example Create a variable when initializing the application:

{{myText}}

[Try it Β»](#) * * * ## Definition and Usage The **ng-init** directive executes the given expression. The **ng-init** directive adds some unnecessary logic to the scope, it is recommended that you can execute it in a controller with the **(#)** directive. * * * ## Syntax All HTML elements support this directive. * * * ## Parameter Values | Value | Description | | --- | --- | | _expression_ | The expression to execute. | * * AngularJS Reference Manual](#)
← Pr Gen ContentNg Ng Init β†’