Link checkbox and button by scope

Description

The following code shows how to link checkbox and button by scope.

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 = {<!--from  w  ww. j a  v  a 2s . co  m-->
        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