---
title: "AngularJs Binding"  
description: "In this article, I’m expaining about the angularjs binding and how to use it."  
author: "Sumit Kesarwani"  
published: 2015-02-25  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/1609/angularjs-binding  
category: "angular js"  
tags: ["angular js", "angularjs directive", "angularjs model"]  
reading_time: 2 minutes  

---

# AngularJs Binding

In this [article](https://yourviews.mindstick.com/view/81489/kashmir-now-after-an-year-of-abrogation-of-article-370), I’m expaining about the [angularjs](https://www.mindstick.com/articles/1611/angularjs-filters) [binding](https://www.mindstick.com/blog/146/dynamic-binding-in-c-sharp) and how to use it.\

Start by [setting up](https://www.mindstick.com/articles/13112/setting-up-the-perfect-configuration-for-your-work-computer) a div with ng-app directive and include the angular.min.js [file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp) using the angulatjs [cdn](https://www.mindstick.com/articles/333301/how-to-leverage-cdns-for-seamless-content-distribution) :

```
<!DOCTYPE html> <html><head>    <meta name="viewport" content="width=device-width" />    <title>AngularJs Example</title>        <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script></head> <body>    <div ng-app="">    </div></body></html>
```

When you write the ng-app directive in the <div> tag, then it tells you that everything in the <div> is belongs to the angularjs app and its also tells you the [scope](https://www.mindstick.com/interview/372/what-are-the-different-scopes-for-java-variables) of the angularjs application.

Binding can be represented in AngularJS using the ng-bind directive or with double curly brackets. We can [test](https://yourviews.mindstick.com/view/81706/know-about-polygraph-test-which-might-be-used-on-rhea-chakraborty) this out by [trying](https://answers.mindstick.com/qa/99245/why-people-are-trying-to-defame-hindu-festival-like-holi) some expressions in our div:

```
<!DOCTYPE html> <html><head>    <meta name="viewport" content="width=device-width" />    <title>AngularJs Example</title>    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script></head> <body>    <div ng-app="">        {{3 + 2}}        {{"Mark" +
"David"}}        {{3 * 9}}    </div></body></html>
```

##### Let try another example using the ng-bind directive:

\

```
<html><head>    <meta name="viewport" content="width=device-width" />    <title>AngularJs Example</title>    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script></head> <body>    <div ng-app="">        <label>Firstname : </label>        <input type="text" ng-model="txtfirstname"/>              <label>Full Name : </label> <span ng-bind="txtfirstname"></span>    </div></body></html>
```

##### Output:

![AngularJs Binding](https://www.mindstick.com/mindstickarticle/fe1ba53f-8978-4b91-ad46-c5cd486a1377/images/1cbe1dff-5262-437d-8e55-b211d54d4353.png)\

As soon as, you typing the content in the textbox, you will see that the value of the textbox is reflecting in Full Name because we have bind the txtfirstname model to the span using ng-bing directive.Let try another example using two boxes and concatenate their values using the binding in angularjs:

```
<!DOCTYPE html> <html><head>    <meta name="viewport" content="width=device-width" />    <title>AngularJs Example</title>    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script></head> <body>    <h2>AngularJs Binding Example</h2>    <div ng-app="">         <label>Firstname : </label>        <input type="text" ng-model="txtfirstname"/>        <br />        <br />        <label>Lastname : </label>        <input type="text" ng-model="txtlastname"/>        <br />        <br />         <label>Full name : </label> {{txtfirstname + "
" + txtlastname}}    </div></body></html>
```

##### Output

![AngularJs Binding](https://www.mindstick.com/mindstickarticle/fe1ba53f-8978-4b91-ad46-c5cd486a1377/images/a1b5c213-0158-4308-882a-f28d5da1ef36.png)

---

Original Source: https://www.mindstick.com/articles/1609/angularjs-binding

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
