[angularjs] two-way binding example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html ng-app="app">
  <head>
    <meta charset="utf-8">
    <title>Angularjs</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.js" charset="utf-8"></script>
  </head>
  <body ng-controller="ctrl as vm">
    <input type="text" ng-model="vm.title">
    <pre ng-bind="vm.title"></pre>
    <span>{{vm.title}}</span>
 
    <script type="text/javascript">
      angular.module('app',[])
        .controller('ctrl',function($scope){
          var vm = this;
          vm.title = "change the value";
        });
    </script>
  </body>
</html>
cs


angularJs two-way binding example

angularJs Verstion : 1.4.9


:: codepen.io

See the Pen angularjs 1.4 two-way binding by homin ahn (@beans9) on CodePen.