angularjs 如何在单击按钮时绑定文本框值

angularjs how can i bind textbox values on button click

请帮助我如何在按钮单击事件期间绑定这些 ng-model(a,b) 值

    <input type="text"  ng-model="a"/><b>Enter A Value</b>
    <input type="text" ng-model="b" /><b>Enter b Value</b>
    <button ng-click="Addition()">add</button>

Angular.js

$scope.Addition = function () {
        $scope.a = 10;
        $scope.b = 20;

        $state.go('Add', {
            a: $scope.a,
            b: $scope.b
        }
}

这里当我点击按钮时 a=10 b=20 值移动但不是我输入的值

它工作正常我没发现任何问题

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

app.controller("myController",function($scope){
$scope.Addition= function(){
console.log("Value of a is "+$scope.a);
console.log("Value of b is "+$scope.b);

}
})
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myController">
 <input type="text"  ng-model="a"/><b>Enter A Value</b>
    <input type="text" ng-model="b" /><b>Enter b Value</b>
    <button ng-click="Addition()">add</button>
</div>
 

试试这个
在 html

<input type="text"  ng-model="a"/><b>Enter A Value</b>
<input type="text" ng-model="b" /><b>Enter b Value</b>
<button ng-click="Addition(a,b)">add</button>

在 js 上

$scope.Addition(a,b){
    console.log(a + " " + b)
}