The
ng-bind directive provides one way
binding between the model and the View, and changes made in the view will not
be reflected in the model. The ng-bind directive is similar to using
expressions {{ expression }} in AngularJS.
The below example shows a simple implementation of ng-bind to achieve one way data binding between the model and the view.
<html ng-app>
<head>
<meta charset="utf-8" />
<title>AngularJS - Basic</title>
<script src="angular.min.js"></script>
</head>
<body>
<div ng-init="Name='FirstName, LastName'">
Your Name is: <span type="text" ng-bind="Name"></span><br/><br/>
</div>
</body>
</html>
The below example shows a simple implementation of ng-bind to achieve one way data binding between the model and the view.
<html ng-app>
<head>
<meta charset="utf-8" />
<title>AngularJS - Basic</title>
<script src="angular.min.js"></script>
</head>
<body>
<div ng-init="Name='FirstName, LastName'">
Your Name is: <span type="text" ng-bind="Name"></span><br/><br/>
</div>
</body>
</html>
Output
No comments:
Post a Comment