Home > DeveloperSection > Forums > How to bind text box to the the text
Anupam Mishra

Total Post:135

Points:949
Posted on    March-03-2016 11:19 PM

 Angular JS JavaScript  Angular JS  CSS 
Ratings:


 1 Reply(s)
 259  View(s)
Rate this:
Hi all,

I have one textbox and i want to enter a username in the Live Preview text box; the text below the text box changes instantly. Please give me a solution.

Thank you.


Sachin Singh
Sachin Singh

Total Post:26

Points:182
Posted on    March-03-2016 11:43 PM

Hi Anupam,

If We want to bind with text box in angular js then be use ng-bind directives.
Here, below  we are using such bind in the program:

  <script>
  angular.module('binduserName', [])
  .controller('myController', ['$scope', function ($scope) {
   $scope.username =username;
   }]);
</script>
<div ng-controller="myController">
 <label>Enter User name: <input type="text" ng-model="username"></label><br>
  Hello <span ng-bind="username"> </span>!
</div>

Output:



Here ,when we changed with another text ,it will display that text in the below of textbox.

Modified On Sep-01-2016 01:46:37 AM

Don't want to miss updates? Please click the below button!

Follow MindStick