Dies ist HTML-Seiteng-Modell nicht in select-Tag unter ng-repeat arbeitet
<form name="createPromoterFormName">
<div class="col s12" ng-repeat="customer in model.customers" ng-if="model.selectedCustomerSubtab == $index">
<div class="row inputcontainer">
<div class="input-field col s4">
<input placeholder="First Name" type="text" ng-model="customer.customer_name" class="validate" ng-maxlength="50" ng-required="true" />
<label class="active labelName">Customer Name </label>
</div>
<div class="input-field col s4">
<input type="text" class="validate" ng-maxlength="50" ng-required="true" ng-model="customer.avg_monthly_sales" />
<label class="active labelName">Average Monthly Sales </label>
</div>
<div class="input-field col s4">
<select ng-model="customer.avg_payment_cycle_days" ng-options="i.value as i.value for i in model.avgPaymentCycleDays" ng-change="changeSelectedItem()">
<option value="">Select Average Payment Cycle Days</option>
</select>
<label class="labelName">Avg Payment Cycle Days [[customer.avg_payment_cycle_days]]</label>
</div>
</div>
<div class="row inputcontainer">
<div class="input-field col s4">
<input type="text" class="validate" ng-maxlength="50" ng-model="customer.avg_paymmonths_in_business_with_customerent_cycle_days" />
<label class="active labelName">Months in business with customer</label>
</div>
</div>
</div>
</form>
Controller.js
$scope.model = {
customers: [{
customer_name: "",
avg_monthly_sales: "",
avg_payment_cycle_days: "",
months_in_business_with_customer: ""
}, {
customer_name: "",
avg_monthly_sales: "",
avg_payment_cycle_days: "",
months_in_business_with_customer: ""
}, {
customer_name: "",
avg_monthly_sales: "",
avg_payment_cycle_days: "",
months_in_business_with_customer: ""
}],
avgPaymentCycleDays : [{
value: '15',
id: '1'
}, {
value: '30',
id: '2'
}, {
value: '45',
id: '3'
}, {
value: '60',
id: '4'
}, {
value: '75',
id: '5'
}, {
value: '90',
id: '6'
}],
selectedPromoterSubtab: 0,
selectedCustomerSubtab: 0,
}
$scope.changeSelectedItem = function() {
console.log($scope.model.customers);
}
ich Material css verwenden. Wenn ich eine Option auswähle, erhält ng-change keinen Trigger und bindet auch keine Daten an das ng-Modell.
Kann mir jemand helfen, wo mache ich Fehler?
Ich habe einen Plünderer basierend auf Ihrem Code erstellt und es scheint gut zu funktionieren. https://plnkr.co/edit/Zq8PDunpAh82Sij8WnAO?p=preview. etwas anderes muss es brechen. – Deep
@ Deep: Ich stimme dir zu. Auch in meinem Fall funktioniert es gut. Überprüfen Sie, ob Ihr Javascript geladen wird oder andere grundlegende Dinge wie Dateipfad usw. Oder teilen Sie Ihren kompletten Controller. –
Ich habe auch Eingabefelder behalten ... da ng-model Datenbindung funktioniert, aber nicht für wählen –