1234567891011121314151617 |
- app.directive('closePopupBackDrop', ['$ionicGesture', function($ionicGesture) {
- return {
- scope: false, //共享父scope
- restrict: 'A',
- replace: false,
- link: function(scope, element, attrs, controller) {
- //要在html上添加点击事件, 试了很久- -!
- var $htmlEl = angular.element(document.querySelector('html'));
- $ionicGesture.on("touch", function(event) {
- if (event.target.nodeName === "HTML" && scope.myPopup.isPopup) {
- scope.optionsPopup.close();
- scope.myPopup.isPopup = false;
- }
- }, $htmlEl);
- }
- };
- }])
|