AngularJS ng-init command
AngularJS examples
Create a variable to initialize the application:
<Div ng-app = "" ng-init = "myText = 'Hello World!'">
<H1> {{myText}} </ h1>
<H1> {{myText}} </ h1>
try it"
Definition and Usage
ng-init command given expression execution.
ng-init command to add unnecessary logic to scope, it is recommended that you can in the controller ng-controllerinstruction to execute it.
grammar
<Element ng-init = "expression "> </ element>
All HTML elements support the instruction.
Parameter Value
value | description |
---|---|
expression | Expression execution. |