我已经创建了指令信用卡
视图:credit-card.html
<form name="form" novalidate="" id="creditCardAmountInputForm" ng-submit="submit()">
<div class="form-group col-md-5" ng-class="{ 'has-error': form.$submitted && form.amount.$invalid }">
<div class="input-group">
<input type="number" class="form-control" placeholder='{{ "dashboard.buyer.home.wallet_to_wallet.placeholders.amount" | translate }}'
ng-model="transaction.amount" cent-number="" name="amount" required="" server-error="" max="2500">
</div>
</div>
<div class="col-md-3">
<button ng-disabled="user.status != 'activated'" type="submit" ladda="loading" class="btn btn-primary btn-block">{{ "dashboard.buyer.home.wallet_to_wallet.submit" | translate }}</button>
</div>
</form>
控制器:`credit-card.coffee``
angular.module 'App'
.directive 'creditCard', ->
restrict: 'E',
templateUrl: 'views/partials/credit-card.html'
controller: ($rootScope, $scope, ENV, $window, transaction, notifications) ->
$scope.user = $rootScope.user
$scope.wallet = $scope.user.user_wallets[0]
$scope.transaction = {}
$scope.submit = ->
new transaction(
receiver_id: $scope.user.wallet_uuid
amount: $scope.transaction.amount
currency: "EUR"
)
我面临的问题是属性$scope.transaction.amount
未定义。
任何帮助将不胜感激
迈克