当我在angularjs中有多个选择ng-model时,如何从数据库中获取另一个元素。这是我的代码。
index.js
<select size="10" name="ngvalueselect" ng-model="response.data" multiple>
<option ng-repeat="tir in tir2" ng-value="[tir.mapsUrl]">{{tir.id}}</option>
ng-src="{{response.data[0]}}"
controler.js
$http.get('/tir2').then(function(response){
$scope.tir2 = response.data;
var googleMapsUlr = "https://www.google.com/maps/embed/v1/directions?key=AIzaSyD8c33WZF24YwooxisG8EWE2KsTPgZH-3U&origin={0}&destination={1}&avoid=tolls|highways";
angular.forEach($scope.tir2, function(element, key) {
element.mapsUrl = googleMapsUlr.replace("{0}", element.xout + "," + element.yout).replace("{1}", element.xin + "," + element.yin);
});
我想从我的数据库中获取另一个与选定的tir.id相对应的元素。