AngularJS Tutorial
AngularJS Applications
AngularJS Useful Resources
Selected Reading
- AngularJS - Internationalization
- AngularJS - Custom Directives
- AngularJS - Dependency Injection
- AngularJS - Services
- AngularJS - Scopes
- AngularJS - Views
- AngularJS - AJAX
- AngularJS - Includes
- AngularJS - Forms
- AngularJS - Modules
- AngularJS - HTML DOM
- AngularJS - Tables
- AngularJS - Filters
- AngularJS - Controllers
- AngularJS - Expressions
- AngularJS - Directives
- AngularJS - First Application
- AngularJS - MVC Architecture
- AngularJS - Environment Setup
- AngularJS - Overview
- AngularJS - Home
AngularJS Applications
- AngularJS - Lastfm Application
- AngularJS - Leaflet Application
- AngularJS - Timer Application
- AngularJS - Weather Application
- AngularJS - Share Application
- AngularJS - Maps Application
- AngularJS - Chart Application
- AngularJS - Translate Application
- AngularJS - Cart Application
- AngularJS - Drag Application
- AngularJS - Search Tab
- AngularJS - Order Form
- AngularJS - Switch Menu
- AngularJS - Nav Menu
- AngularJS - In-line Application
- AngularJS - Upload File
- AngularJS - Login Application
- AngularJS - Bootstrap Application
- AngularJS - Notepad Application
- AngularJS - ToDo Application
AngularJS Useful Resources
- AngularJS - Discussion
- AngularJS - Useful Resources
- AngularJS - Quick Guide
- AngularJS - Questions and Answers
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
AngularJS - Expressions
AngularJS - Expressions
Expressions are used to bind apppcation data to HTML. Expressions are written inside double curly braces such as in {{ expression}}. Expressions behave similar to ngbind directives. AngularJS expressions are pure JavaScript expressions and output the data where they are used.
Using numbers
<p>Expense on Books : {{cost * quantity}} Rs</p>
Using Strings
<p>Hello {{student.firstname + " " + student.lastname}}!</p>
Using Object
<p>Roll No: {{student.rollno}}</p>
Using Array
<p>Marks(Math): {{marks[3]}}</p>
Example
The following example shows the use of all the above-mentioned expressions −
testAngularJS.htm
<html> <head> <title>AngularJS Expressions</title> </head> <body> <h1>Sample Apppcation</h1> <span ng-app = "" ng-init = "quantity = 1;cost = 30; student = {firstname: Mahesh ,lastname: Parashar ,rollno:101}; marks = [80,90,75,73,60]"> <p>Hello {{student.firstname + " " + student.lastname}}!</p> <p>Expense on Books : {{cost * quantity}} Rs</p> <p>Roll No: {{student.rollno}}</p> <p>Marks(Math): {{marks[3]}}</p> </span> <script src = "https://ajax.googleapis.com/ajax/pbs/angularjs/1.3.14/angular.min.js"> </script> </body> </html>
Output
Open the file testAngularJS.htm in a web browser and see the result.
Advertisements