3
NG-옵션과 AngularJS와 새로운 부가가치를 선택하십시오 NG-옵션 목록의 마지막 항목이 "위치 추가"라고자동 내가 선택 목록이처럼 보이는이
<select
class="form-control"
ng-model="locationList"
ng-options="location.place group by location.type for location in locationlist | orderBy:['type']"
ng-change="addMissingLocation(locationList)">
<option value="">From</option>
</select>
을하고 다음 트리거 NG 변화를 통해 기능 :
$scope.addMissingLocation = function (locationList) {
if (locationList.place == "Add location") {
$('.addMissingLocation').modal('show');
}
}
모달 표시하고, 사용자가 다음 함수를 사용하여 새 위치를 추가 할 수있다 :
$scope.addLocationOtherExtra = function() {
$scope.locationlist.push({ place: $scope.formLocationOther, type: "-Secondary Locations", main:false});
jsonToLocationLocalStorage($scope.locationlist);
$scope.formLocationOther = '';
$('.addMissingLocation').modal('hide');
};
,174을
내가 달성하고자하는 것은 사용자가 새 위치를 도입하고 모달을 닫으면이 새로 추가 된 값인 입니다.
그런 것이 가능한지 확실하지 않습니다.
팁이 있습니까?
우수 답변! –
다행이 당신을 도왔습니다! – dfsq