AngularJS ng-bind example

AngularJS ng-bind attribute tells Angular to replace the text content of the specified HTML element with the value of a given expression. It also updates the text content when the value of that expression changes.

<div ng-app="myApp" ng-controller='MyCtrl'>
  Enter Name: <input type="text" ng-model="name" ng-init="name='John'"><br>
  Hello <span ng-bind="name"></span>!
</div>

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
<script>
  var module = angular.module('myApp', []);
  module.controller('MyCtrl', function($scope) {});
</script>
refresh
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments