What is an ng-bind
directive?
The “ng-bind” as
the name suggest is used to bind/replace text content of any particular HTML
element with the value of given expression that is used against the ng-bind.
The value of the specified HTML element will be updated whenever the value of
given expression will be changes.
Example,
<!DOCTYPE html> <html lang="en"> <head> <title>Angular Demo</title> <script data-require="angular.js@1.5.x" src="https://code.angularjs.org/1.5.8/angular.js" data-semver="1.5.8"></script> <script> var myApp = angular.module("AngularApp", []); myApp.controller("HelloController", function($scope) { $scope.text = "enter text here..."; }); </script> </head> <body ng-app="AngularApp"> <div ng-controller="HelloController"> Enter anything you want to display: <input type="text" ng-model="text">You Entered : <span ng-bind="text"></span> </div> </body> </html>
The Live demo,
Blogger Comment
Facebook Comment