Hello, friends it this tutorial I am going to explain you about ng-bind in  Angular Js. In the previous session, we have discussed ng-model in Angular Js.

Introduction:

The ng-bind directive is used to display the content of variable or expression inside an HTML element. If any changes in the variable or the expression occur, Angular Js also changes the content of the HTML element. The ng-bind is very much different from ng-model. ng-bind supports one-way data binding. ng-bind is very useful. JavaScript framework supports only one-way data binding.

ng-bind

An example of ng-bind:

<!DOCTYPE html>
<html ng-app="helloApp" ng-controller="employeesCtrl">
<head>
<title>AngularJS - ng-model vs ng-bind</title>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script>
 //Creating Angular Module
 var helloApp = angular.module('helloApp', []);

//Creating Controller with Data
 helloApp.controller('employeesCtrl', function($scope) {
 $scope.search="Enter Search Criteria";
});
</script>
</head>
<body>
<!-- Creating input component and attaching to ng-model -->
Search : <input type="text" ng-model="search"><br><br>
Search ng-bind: <input type="text" ng-model="searchBind"><br><br>
<b>Search Term:</b>{{search}}<br><br>
<!--Mapping input component-->
<span ng-bind="searchBind"></span>
<!--Mapping directly to variable-->
<span ng-bind="search"></span>

</body>
</html>

Hope you understand about ng-bind in Angular JS.

You must also follow the related links:

Thank You,

110 Comments

  • If some one needs expert view on the topic of blogging then i recommend him/her to pay a visit this blog, Keep up the good job.|

  • I’m going to do a presentation about thebillboard website . I need some informations about how is started ? and if there is a story behind its starting , and I need to know why it’s important for the media’s life ? Alos, what does it do ?.

  • idis0m You ave made some really good points there. I looked on the net for more information about the issue and found most individuals will go along with your views on this web site.

  • I know of the fact that right now, more and more people are being attracted to camcorders and the industry of taking pictures. However, being photographer, you need to first shell out so much of your time deciding the model of camera to buy plus moving store to store just so you could possibly buy the lowest priced camera of the brand you have decided to pick out. But it won’t end now there. You also have to take into consideration whether you should obtain a digital video camera extended warranty. Thanks a lot for the good points I obtained from your weblog.

  • Helpful information. Lucky me I discovered your web site unintentionally, and I am stunned why this coincidence did not took place in advance! I bookmarked it.|

  • It’s very easy to find out any topic on web as compared to books, as I found this post at this web site.|

  • Somebody essentially help to make seriously posts I would state. This is the first time I frequented your web page and thus far? I amazed with the research you made to make this particular publish incredible. Wonderful job!

  • I¡¦ve recently started a website, the info you provide on this website has helped me greatly. Thank you for all of your time & work.

  • Wow! This can be one particular of the most helpful blogs We’ve ever arrive across on this subject. Actually Great. I am also a specialist in this topic therefore I can understand your effort.

  • Is it safe? . Safer than myspace?. Can you use myspace layouts for it?. How old do you how to be to have one?. . Please answer as many as possible . Thanx :].

  • Thank you for another informative website. Where else may just I am getting that kind of info written in such a perfect means? I’ve a venture that I am simply now operating on, and I’ve been on the look out for such information.