0
내 선택 외모에서 텍스트 상자 NG 모델 값에 페이지로드 기반이 다음 선택 박스가 변경하면동적으로 선택 옵션이 같은 각도
$scope.region = [
{
countryItem : "TW(TW)",
countryCode : "tw_zh_tw"
},
{
countryItem : "US(EN)",
countryCode : "us_en"
},
{
countryItem : "US(ES)",
countryCode : "us_es"
},
{
countryItem : "JP(JA)",
countryCode : "jp_ja"
},
];
것은 그것을 호출합니다 : 이것은 내 JSON
<select onchange="getVideo()" id="region">
<option ng-repeat="items in region" ng-selected = "items.countryCode === selectedRegion" value="{{items.countryCode}}">{{items.countryCode}}</option>
</select>
입니다 getVideo() 함수 인 함수 :
function getVideo() {
var language = $("#region option:selected").val();
location.href="/support/"+language+"/Videobackstage;
}
이 기능을 사용하면 select chang 그래서 페이지가로드되는 경우에도 select 값을 유지해야합니다.
해결책을 생각해 냈습니다. ng-select 조건에 ng-model이라는 텍스트 상자를 사용하고 텍스트 상자에 값이 있고 원하는대로 작동하지만 선택 항목이 있습니다. 작동하지 않는 :
<input type="text" ng-model="selectedRegion" id="selectedRegionx">
내가 URL에 특정 값을 얻어서 텍스트 상자의 값을 설정하고 있습니다 :
$(document).ready(function(){
var pageUrl = window.location.pathname;
var split = pageUrl.split("/");
var langUrl = split[2];
$("#selectedRegionx").val(langUrl);
});