WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

AngularJS ng-init Directive


Example

Create a variable when initiating the application:

<div ng-app="" ng-init="myText='Hello World!'">

<h1>{{myText}}</h1>
Try it yourself »

Definition and Usage

The ng-init mandate assesses the given expression(s).

The ng-init mandate can include some superfluous rationale into the degree, and you are prescribed to do your assessments in a controller rather, see the ng-controller directive.


Syntax

<element ng-init="expression" ></element>

Supported by all HTML elements.


Parameter Values

Value Description
expression An articulation to evaluate.