Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Contributor: Ravishankar ChavarePart 6.2-ngBind Directives
#1
ng-bind Directives

-Binds the content of an Html element to application data.
-ng-bind directive tells angular js to replace the content of an html element within the value of a given variable or expression.
-Update the text content when  the value of that expression changes.


Syntax:
Code:
<element ng-bind="expression"></element>


Example:

Code:
<!DOCTYPE html>
<html ng-app="myApp" >
<head>
<title>mvc</title>
<script src="../angular.min.js"></script>
<script type="text/javascript">
var app=angular.module("myApp",[]);
app.controller("myController",function($scope){
$scope.name="ravi";
});
</script>
</head>
<body>
<div ng-controller="myController">
<input ng-model="name">

<br>
below output is binded from input box model<br> whenever input changes ng-bind fetch the updated value and updtae it
<p ng-bind="name"></p>

<br>
</div>

</body>
</html>



OUTPUT:
[Image: t1vtDIn.png]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)