Você está na página 1de 4

AngularJS Expression | Java Web Tutor

1 of 4

file:///C:/Users/ScNayak/Desktop/AngularJS/6 AngularJS Expression _ ...

Privacy Policy

Home

Java

JavaEE

Frameworks

Spring

Web Services

Web

Contact

Misc

About Us

Tools & Tips

Adds
Home >> AngularJS

AngularJS - Expressions
April 10, 2016 by Mukesh Kumar at 3:47 pm

What is AngularJS Expressions


AngularJS Expressions are used to bind
application data to html.It starts with "{{" and ends
with "}}".AngularJS application expressions are
pure JavaScript expressions and outputs the data
where they are used.
Integrating JSP,Servlet and Hibernate in
an MVC application

You can write expressions on


Numbers,Strings,Objects,Arrays

Hibernate Query Language HQL select,


Update And Delete Example
Hibernate Query Language

AngularJS expressions can also be written inside


ng-bind

JSF Page Navigation Tutorial

directives

JSF Validation Tutorial


Hibernate One-To-Many XML Mapping

AngularJS Expression Example

JSF Example: Using JSF 2.0, Eclipse,

AngularJS expression can contain literals,


operators and variables like JavaScript
expression. For example, an expression {{10/2}}
will produce the result 5 and will be bound to
HTML.

And Maven
Jboss Tools Installation in Eclipse
Jboss Installation in Eclipse
Database Application Using JSF
Java Web Application With Maven
Spring HelloWorld Example Using
Eclipse And Maven

Example

HTML

EJB3 and JPA Example

ED IT

Result

<html><head><script
src="https://ajax.googleapis.com/ajax/libs
/angularjs/1.0.7/angular.min.js"></script>
</head><body><h1>AngularJSExpression
Example:</h1><divngapp>10+2=
{{10+2}}<br/>22={{22}}
<br/>10*2={{10*2}}<br
/>2/2={{2/2}}</div></body>
</html>

O N

10 + 2 = 12
2-2=0
10 * 2 = 20
2/2=1

AngularJS expression can contains literals of any data type.

Example:

10/9/2016 12:49 AM

AngularJS Expression | Java Web Tutor

2 of 4

HTML

file:///C:/Users/ScNayak/Desktop/AngularJS/6 AngularJS Expression _ ...

ED IT

Result

<html><head><script
src="https://ajax.googleapis.com/ajax/libs
/angularjs/1.0.7/angular.min.js"></script>
</head><body><h1>AngularJSExpression
Example:</h1><divngapp>{{"Hello
World"}}<br/>{{100}}<br/>
{{true}}<br/>{{95/10}}</div>
</body></html>

O N

Hello World
100
true
9.5

AngularJS expression can contain variables declared via ng-init directive. Consider the example given
below.

HTML

ED IT

Result

<html><head><script
src="https://ajax.googleapis.com/ajax/libs
/angularjs/1.0.7/angular.min.js"></script>
</head><body><h1>AngularJSExpression
Example:</h1><divngapp
nginit="message='HelloWorld!';amount=
5000;rateOfInterest=12.5;duration=10;
myArr=[100,200];person={
firstName:'Mukesh',lastName
:'Kumar'}">{{(amount*
rateOfInterest*duration)/100}}<br
/>
{{myArr[1]}} <br />

O N

6250
200
Mukesh Kumar

In Next Chapter we will discuss about AngularJS - Modules

References :- AngulaJS Documentation

Related Articles
1. Maven Overview

Index

10/9/2016 12:49 AM

AngularJS Expression | Java Web Tutor

3 of 4

file:///C:/Users/ScNayak/Desktop/AngularJS/6 AngularJS Expression _ ...

We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
0 Comments

javawebtutor

Share

Recommend

Login

Sort by Best

Start the discussion

JAVAWEBTUTOR

AngularJS - Controllers

JPA Example using Maven and Hibernate as


JPA Provider

AngularJS
Controllers------------------------What is
Controllers--------------------The controller in

Web Application With Hibernate,JSP and


Servlet using Eclipse

Introduction to Spring Framework

Thank you for a great


tutorial, much appreciated. I would like to know
something regarding adding multiple records in

Subscribe d

Add Disqus to your site Add Disqus Add

Good Jpa hibernate and maven


example. One thing that is missing in the
persistence.xml is the declaration of

Spring Autowiring by Name Example


---------------------------------- In Autowiring by Name
mode, spring framework will try to find out a

Privacy

Top of Page

10/9/2016 12:49 AM

AngularJS Expression | Java Web Tutor

4 of 4

About Us
Privacy Policy
Contact Us
javawebtutor.com 2013-2016

file:///C:/Users/ScNayak/Desktop/AngularJS/6 AngularJS Expression _ ...

DISCLAIMER
Oracle & Java are registered
trademarks of Oracle and/or its
affiliates. Other names may be
trademarks of their respective
owners. javawebtutor.com is not
connected to Oracle Corporation
and is not sponsored by Oracle
Corporation.The Examples &
Tutorial provided here are for
learning purpose only. we do not
warrant the correctness of its
content. The risk from using it lies
entirely with the user.

ABOUT US

FREE
EBOOKS

javawebtutor.com is a site
dedicated to bringing you the
coolest java and related web
development tutorials and
resources.
ABOUT US

Download
ebooks.

DOWNLOAD IT

LEARN MORE

10/9/2016 12:49 AM

Você também pode gostar