Expressions in Angularjs

Google Advertisements

AngularJS Controller AngularJS MVC Architecture


AngularJS Expressions used to binds application data to HTML. AngularJS expressions are written inside double curly braces such as : {{ expression }}. Angularjs Expressions behave same like to ng-bind directives. AngularJS expressions are pure JavaScript expressions and output of the data display where they are used.

Sample Example of AngularJS Expressions



First Number
Second Number

Sum: {{num1 + num2}}

Sub: {{num1 - num2}}

Mul: {{num1 * num2}}

Div: {{num1 / num2}}


<!DOCTYPE html>
<html lang="en">
<div ng-app="" ng-init="num1=10; num2=1">

First Number  <input type="number" ng-model="num1"><br>
Second Number <input type="number" ng-model="num2">

<p><b>Sum:</b> {{num1 + num2}}</p>
<p><b>Sub:</b> {{num1 - num2}}</p>
<p><b>Mul:</b> {{num1 * num2}}</p>
<p><b>Div:</b> {{num1 / num2}}</p>

<script src=""></script>

Note: when you remove the ng-app directive, Html will display the expression as it is, without solving it.

Use Expression for String


<div ng-app="" ng-init="firstName='Harry'; lastName='Porter';">

<p>Full Name: {{firstName + " " + lastName }}</p>

Use Expression for Array


<div ng-app="" ng-init="array=[10,15,20,25,30]">
<p>Second Element is {{ array[1] }}</p>

Example using ng-bind for String


<!DOCTYPE html>
<script src= ""></script>

<div ng-app="" ng-init="firstName='Harry'; lastName='Porter';">
<p>Full Name:  <span ng-bind="firstName + ' ' + lastName"></span></p>


AngularJS Controller AngularJS MVC Architecture

Google Advertisements

Buy This Ad Space @$50 per Month, Ad Size 600X200 Contact on: or 8076671483

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Cloud computing is the on demand availability of computer system resources, especially data storage and computing power, without direct active management by the user. Cloud Computing Tutorial

College Projects Related to Java, AWT, C Projects for College, C++ Projects for College, Android Projects. Download Java C C++ Projects

Download Projects

Adsense Advertisements

Buy This ads Space 8076671483

Buy This Ad Space @$120 per Month, Ad Size 300X600 Contact on: or 8076671483 Try this Keyword C++ Programs