2016-12-26 37 views
-2

enter image description here通價值

請問關於角 我是一個初學者, 我需要從巴頓傳值輸入文本 我有很多按鈕一樣

當我按緊鄰的文本值將改變

+0

您使用的角度JS? – xxCodexx

+0

是我使用角JS&初級 –

+0

交真實代碼,而不是它的一個圖像 –

回答

0

如果您使用的角js然後下面的東西可以幫助你。

var app = angular.module('app', [ ]); 
 

 
app.controller('MyController', function($scope) { 
 
    $scope.setValue = function(number){ 
 
    $scope.myValue = number; 
 
    }; 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js"></script> 
 
<body ng-app="app"> 
 
    <div ng-controller="MyController"> 
 
    <button ng-click=setValue('One')>One</button> 
 
    <button ng-click=setValue('Two')>Two</button> 
 
    <button ng-click=setValue('Three')>Three</button> 
 
    <input value="{{myValue}}" /> 
 
    </div> 
 
</body>