0
一個輸入如何通過angularjs與另一個輸入相同的值?我知道如何通過jQuery來做到這一點,但不是在angularjs中。這裏是我的代碼:兩個輸入相同的值angularjs
<body ng-app="peopleApp">
<div ng-controller="myController">
<input class="form-control input-form" ng-model="input.user_code" name="user_code" type="text" maxlength="4" minlength="4" required>
<input class="form-control input-form" ng-model="input.username" name="username" type="text" required>
</div>
</body>
<script type="text/javascript">
var peopleApp = angular.module('peopleApp', []);
peopleApp.controller('myController', function(){
$scope.input = {
'username': $scope.input.user_code
}
});
</script>
所以基本上我想要的是相同的值作爲第二輸入元件
完美答案! –