I have a payment directive as below. A payment can have one of a number of different payment methods. There is a select list in side the template which should be from a list of payment methods that are passed in.
But at the moment the select list is not being populated with anything.
I'm pretty new to angular.
Payment Directive
angular.module('filanthropyApp.directives', [])
.directive('payment', function () {
return {
restrict: 'EA',
templateUrl: '/Content/filanthropyApp/Directives/Templates/payment.html',
replace: true,
scope: {
paymentMethods: '=paymentMethods'
}
};
});
Payment Template
<div>
<div class="col-md-8 input-group">
<label class="control-label col-md-4">Payment Amount</label>
<input type="text" class="form-control" value="{{payment.Amount}}" ng-model="payment.Amount" />
</div>
<div class="col-md-8 input-group">
<label class="control-label col-md-4">Payment Method</label>
<select ng-model="payment.PaymentMethodId" name="paymentMethods" ng-options="paymentMethod.Id as paymentMethod.Name for paymentMethod in paymentMethods">
<option value="">Select a Payment Method</option>
</select>
</div>
Calling Page
<section id="payments">
<div class="form-group payment" ng-repeat="payment in pledgeData.Payments">
<payment paymentMethods="pledgeData.PaymentMethods" />
</div>
<button class="btn btn-default" ng-click="addPayment()">Add New Payment</button>
</section>