我有这个html模板:
<br>
<input type="number"
name="input"
required
class="form-control input-md"
ng-model="totalPay"
placeholder="Amount"
ng-minlength="1"
ng-maxlength="3"
min="1"
max="150">
<td><select ng-options="reason for reason in refundReasons" required ng-model="chosenReason">
<option value="">Select refund reason</option>
</select></td>
<br>
<button class="btn btn-primary" ng-click="payDriver(userId, totalPay, chosenReason)">Pay driver</button>
</p>
出于某种原因,无论我如何尝试,我都会获得totalPay == undefined
。
其他值userId
和chosenReason
符合预期。
我的控制员:
var opsToolControllers = angular.module('opsToolControllers');
opsToolControllers.controller('payoutCtrl', ['$scope', '$location', 'Util', 'User', 'Payout', function ($scope, $location, Util, User , Payout) {
$scope.refundReasons = ["1 -- No show compensation", "2 -- Bonus not paid"];
$scope.userId = null;
$scope.totalPay = null;
这是我尝试调用的控制器中的方法:
$scope.payDriver = function (userId, total, chosenReason) {
Payout.payDriver(userId, $scope.totalPay, chosenReason, successCallBack, errorCallBack())
};
arg total == undefined
和正文$scope.totalPay == null