YouTip LogoYouTip

Ng Ng Init

# AngularJS `ng-init` Directive [![Image 3: AngularJS Reference](#) AngularJS Reference](#) * * * ## 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 execute it in the controller using the **(#)** directive. * * * ## Syntax The directive is supported by all HTML elements. * * * ## Parameter Values | Value | Description | | --- | --- | | _expression_ | The expression to be executed. | * * AngularJS Reference](#)
← Ng Ng MouseenterNg Ng Model Options β†’