{{myText}}

``` --- ## Definition">

{{myText}}

``` --- ## Definition" />
Easy Tutorial
❮ Angularjs Http Ng Ng Cut ❯

AngularJS ng-init Directive

AngularJS Reference Manual


AngularJS Example

Create a variable when initializing the application:

<div ng-app="" ng-init="myText='Hello World!'"><h1>{{myText}}</h1>

Definition and Usage

The ng-init directive evaluates the given expression.

The ng-init directive adds unnecessary logic to the scope, it is recommended to execute it in a controller instead.


Syntax

This directive is supported by all HTML elements.


Parameter Values

Value Description
expression The expression to be evaluated.

AngularJS Reference Manual

❮ Angularjs Http Ng Ng Cut ❯