Angularjs ng-init


Angularjs ng-init : Angularjs ng-init with Numbers example and demo.


Example : Angularjs Numbers

<div ng-app="" >

    <p>Sum = {{10 + 10}} </p>

</div>

Example 1

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
</head>

<body>
<div ng-app="" >

    <p>Sum = {{10 + 10}} </p>

</div>

</body>
</html>

Try it »

Example Using ng-init

Example 2

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
</head>
<body>
<div ng-app="" ng-init="a=10;b=15">
    <p>Multiple = {{a*b}} </p>
    <p>Division = {{a/b}} </p>
</div>
</body>
</html>

Try it »


Advertisements

Add Comment

📖 Read More