angularjs two way binding

  • 179
  • 0

雙相綁定

<script src="~/Scripts/ngcontroller.js"></script>
<div ng-app="myModule">
    <div ng-controller="myController">

        <input type="text" ng-model="FirstName" /><br />
        FirstName:{{ FirstName }}

    </div>

</div>

 

var myApp = angular.module("myModule", []);

myApp.controller("myController", function ($scope) {
    
    $scope.FirstName = "Charles";
});