2017-05-18 2 views
0

Angular UI Boostrap DatePicker에서 날짜 선택에 대한 코드를 작성하고 싶습니다.Angular UI Bootstrap의 이벤트를 닫습니다. DatePicker

다음과 같이 ng-change 이벤트를 사용해 보았습니다. 날짜가 변경되지 않으면 호출하지 않습니다. 우리가 도움이 될만한 팝업 이벤트를 감지 할 수 있다고하더라도 close 이벤트를 감지하기위한

ctrl.changeDate = function() { 
    console.log('called date'); 
} 

내 HTML 코드

<input type="text" class="form-control" 
    uib-datepicker-popup="{{'dd/MM/yyyy'}}" 
    ng-model="$ctrl.model[$ctrl.name]" 
    ng-show="$ctrl.editMode" 
    is-open="$ctrl.popup1.opened" 
    datepicker-options="{dateDisabled: disabled,formatYear: 'yy',startingDay: 1}" 
    close-text="Close" 
    alt-input-formats="['dd/MM/yyyy']" 
    ng-focus="$ctrl.open1()" 
    ng-change="$ctrl.changeDate()" 
/> 

답변

1

시계는 속성을 열

$scope.$watch('$ctrl.popup1.opened',function(newVal, oldVal){ 
    if(newVal != oldVal && !newVal){ 
     //close event 
    } 
})