Я передал значение из db радиокнопке, оно содержит источник и назначение в форме «источник, назначение», мне нужно разделить их и вызвать отдельно из другого текстового поля. Но я получаю оба значения каждый раз.Как это преодолеть?
Это HTML (переключатель)
<input class="radioBtn" type="radio" name="order" ng-model="savedSourceDestination" value={{savedLocationByIdList.sourceAddress}},{{savedLocationByIdList.destinationAddress}}> {{savedLocationByIdList.sourceAddress}} to {{savedLocationByIdList.destinationAddress}}<br>
Это контроллер `
SavedLocation();
function SavedLocation() {
customerService.one('getSavedLocationById', 1).get().then(function (response) {
$scope.savedLocationByIdList = response.data;
}, function error(failure) {
$scope.catalogList = {};
alertService.showAlert({
title: 'Failure',
message: failure.data.message
});
});
$scope.getSelectedValue=function(){
var radioBtns = document.getElementsByClassName("radioBtn");
for(var i = 0; i < radioBtns.length; i++){
if(radioBtns[i].checked){
document.getElementById("recent").value = radioBtns[i].value;
}
}
}
}
`
Исходное текстовое поле
<input id="recent" style="margin-left:10px" places-auto-complete size=54 ng-model="origin"
ng-blur="getfromAddres()" component-restrictions="{country:'in'}" types="{{types}}"
on-place-changed="originChanged()" value=""/>
То же самое с текстовым полем назначения.
Я попытался разбить функцию данных, но не работает.