-
Notifications
You must be signed in to change notification settings - Fork 0
/
appMainTest.js
25 lines (25 loc) · 1002 Bytes
/
appMainTest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
app.directive('dropdownMenu', ['$document', function ($socument) {
return {
restrict: 'E',
template: '/components/dropdown-menu.html',
controller: ['$scope', function ($scope) {
// 必要に応じて処理を定義…
}],
link: function (scope, element, attrs) {
var close = function ($event) {
scope.$apply(function () {
scope.isActive = false;
$document.unbind('click', close);
});
};
scope.isActive = false;
scope.clickButtonHandler = function ($event) {
$event.stopPropagation();
scope.isActive = !scope.isActive;
};
scope.$watch('isActive', function (newValue) {
newValue && $document.bind('click', close);
});
}
};
}]);