AngularJS ng-init Directive Multiple Values Example

AngularJS ng-init Directive Multiple Values Example

In this Post We Will Explain About is AngularJs ng-init Directive with Multiple Values With Example and Demo. Create a simple variable when application initiating the application and The ng-init simple directive using Angularjs evaluates this HTML dom given expression(s).and Declare multiple values in ng-init my this post to Welcome on infinityknow.com,The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to create a simple AngularJS ng-init Directive Multiple Values Example

Syntax

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

First of all simple you need to simple add an js using external Angular.js file content to your web-application, in External angularjs libs other words “angular.min.js”.

READ :  jQuery Ajax Live Editable Table Records using PHP MySQLi

AngularJs ng-init Directive with Multiple Values

 
<html>
<head>
<title>
Simple Example AngularJs ng-init Directive with Multiple Values
</title>
<script src="angular.min.js"></script>
</head>
<body>
<div ng-app="" ng-init="comment1='Hi';message2='Welcome to Tutlane Website'">
<h2>AngularJs simple ng-init Directive with Multiple Values Example</h2>
<p>{{comment1}}, {{message2}}</p>
</div>
</body>
</html>

Use a simple ng-init function, al the way more readable:

Example 1: AngularJS ng-init Multiple Values Example

ng-init="init()"

Example 2: AngularJS ng-init Multiple Values Example

$scope.init = function() {
    $scope.first = 1;
    $scope.second = 2;
}

Example : 3 AngularJS ng-init Multiple Values Example

ng-init="first = 1; second = 2"
or
ng-init=" first='live24u'; second='mydata' "  

Example

I hope you have Got What is Declare multiple values in ng-init Example And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

READ :  AngularJS Image Slider - AngularJS Image Carousel Slider

Add a Comment

Your email address will not be published. Required fields are marked *