사용자 지정 드롭 다운 선택기가 있습니다. 브라우저의 아무 곳이나 클릭하면 드롭 다운을 토글하고 싶습니다. toggleModules()
이 드롭 다운 내에서 작동합니다.각도 토글 사용자 지정 드롭 다운
데이터 : modules=["A", "B", "C", "D", "E", "F"]
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-12">
<div class="vov-filters ov-filter-region">
<span ng-click="toggleModules($event)"><label>Module</label>
<b id="caret-glyph" class="glyphicon glyphicon-chevron-down pull-right" area-hidden="true"></b>
</span>
<div id="el1" class="overlay bordered" ng-if="showModules">
<span role="button" ng-click="clearSelectedModules()" class="clear">Clear</span>
<div class="filter-checkbox" ng-repeat="entry in modules" ng-click="moduleFilter(entry)">
<label>
<input ng-show="entry.show" type="checkbox" ng-model="entry.show">
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
{{entry.name}}
</label>
</div>
</div>
</div>
</div>
컨트롤러 : FN 전환 -
$scope.toggleModules = function(ev) {
ev.preventDefault();
ev.stopPropagation();
$scope.showModules = !$scope.showModules;
if ($scope.showModules) {
$scope.overlay = true;
} else {
$scope.overlay = false;
}
};
같은 콘트롤 : $ 문서를 클릭 이벤트 : 당신은 N을 만들 수 있습니다
$document.on('click', function(event) {
<!-- Start Toggle Module filter -->
$scope.toggleModules(event)
<!-- End Toggle Module filter -->
return $document.off('click', event);
});
하지만 난 현재의 컨트롤러에서 같은 handdle 솔루션을 찾고 있어요. 어떠한 제안?? –