如何使用angularjs實現文字框設定值

魔豆發表於2016-01-30
<!DOCTYPE html>
<html ng-app="myApp">
<head>
    <title>angularjs-setValue</title>
</head>
<body ng-controller="body">
    <input type="text" name="input1" ng-model="input1"><br />
    <input type="text" name="input2" ng-model="input2"><br />
    <script type="text/javascript" src="js/angular.min.js"></script>
    <script type="text/javascript">
    var myApp = angular.module('myApp',[]);
    myApp.controller('body', function($scope){
        $scope.input1 = "aaaa";
        $scope.input2 = "bbbb";
    });
    </script>
</body>
</html>

 

相關文章