Bind button text with scope value

Description

The following code shows how to bind button text with scope value.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
var TermsController = function($scope) {
    $scope.terms = {<!--   w  w  w  .j  a va  2 s  . com-->
        label : "After"
    }
}
</script>
</head>
<body ng-app>
  <div ng-app>
    <div ng-controller="TermsController" ng-cloak>
        <input type="checkbox" ng-model="terms.label">
        <button type="submit" ng-bind="terms.label">Before</button>
    </div>
</div>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities