AngularJS Expressions with example and demo

AngularJS Expressions with example and demo

AngularJS Expressions with example and demo, Expression are used to bind application data to html.The angularjs provide the essay access of express. Expressions are written inside double braces like {{ expression}}. Expressions behaves in same way as ng-bind directives. AngularJS application expressions
are based on pure javascript expressions and outputs the data where they are used.

Expression

Using numbers–

Expense on Books : {{cost * quantity}} Rs

Using strings–Hello {{student.firstname + ” ” + student.lastname}}!

Using object–Roll No: {{student.rollno}}

Using array–Marks(Math): {{marks[3]}}

AngularJS Expressions Example

    <html>
    <title>AngularJS Expressions Example</title>
    <body>
    <h1>AngularJS Expressions Example</h1>
    <div ng-app="" ng-init="quantity=5;cost=40; student={firstname:'Pramod',lastname:'Kumawat',rollno:185};marks=[80,90,75,73,60]">
       <p>Welecome {{student.firstname + " " + student.lastname}}!</p>   
       <p>Cost on Books : {{cost * quantity}} Rs</p>
       <p>Roll No: {{student.rollno}}</p>
       <p>Marks(Math): {{marks[4]}}</p>
    </div>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
    </body>
    </html>
AngularjsexpressionExample

AngularjsexpressionExample

Share Button

About admin

Leave a Reply

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

*

Author: pramod kumar kumawat Mob: 9269727062
Free WordPress Themes - Download High-quality Templates