Nach der Ansicht Code, den ich mehr wählen DropdownWie erhalte ich ausgewählte Werte aus dem Drop-Down-Bereich in den Bereich, während ich die verschachtelte ng-Option verwende?
<div ng-controller="sourceController">
<form novalidate ng-submit="submit()">
<div class="row">
<div class="addNewButton">
<button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#myModal">Add New Data Source</button>
<div ng-include="'pages/modal.html'"></div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
Location:
<select id="location" ng-model="location" ng-options="city for (city, facilities) in sourceSelection " style="width: 100px">
<option value=''>Select</option>
</select>
</div>
<div class="col-sm-3">
Facility:
<select id="facility" ng-disabled="!location" ng-model="facility" ng-options="facility for (facility, phases) in location">
<option value=''>Select</option>
</select>
</div>
<div class="col-sm-3">
Phase :
<select id="phase" ng-disabled="!facility" ng-model="phase" ng-options="phase for phase in facility">
<option value=''>Select</option>
</select>
</div>
<div class="col-sm-3">
Device Type
<select id="deviceType" ng-disabled="!phase" ng-model="deviceType">
<option value=''>Select</option>
<option ng-repeat="deviceType in deviceTypes" value="{{deviceType}}">{{deviceType}}</option>
</select>
</div>
</div>
<input type="submit" id="submit" value="Submit" />
</form>
<button onclick="myFunction()">click here</button>
selected choices : {{location}} , {{facility}},
</div>
und der Steuerung Ich verwende ist
app.controller('sourceController', function($scope, $http, $rootScope) {
$scope.sourceSelection = {
"Chennai": {
"siruseri": ["phase1", "phase2"],
"chennai one": ["phase1"]
},
"kochi": {
"Kochi_technopark": ["phase1"]
}
};
});
aufzufüllen bin mit Jetzt möchte ich das ausgewählte Feld (i e. ausgewählten Ort, Einrichtung, Phase in Controller) mit $scope
in Controller-Seite und Modell, das ich dort verwende gibt mir den Wert der ausgewählten Dropdown-Taste.
Ich verstehe nicht, was Sie brauchen, können Sie ein bisschen mehr angeben? – miquelarranz
ich füge hier Geige http://jsfiddle.net/sirfabhishek/Lvc0u55v/5534/ –
Ja, aber sagen Sie uns, was Sie mit den Werten tun möchten, damit wir Ihnen erklären können, was als nächstes – miquelarranz