ionicclose.js 677 B

1234567891011121314151617
  1. app.directive('closePopupBackDrop', ['$ionicGesture', function($ionicGesture) {
  2. return {
  3. scope: false, //共享父scope
  4. restrict: 'A',
  5. replace: false,
  6. link: function(scope, element, attrs, controller) {
  7. //要在html上添加点击事件, 试了很久- -!
  8. var $htmlEl = angular.element(document.querySelector('html'));
  9. $ionicGesture.on("touch", function(event) {
  10. if (event.target.nodeName === "HTML" && scope.myPopup.isPopup) {
  11. scope.optionsPopup.close();
  12. scope.myPopup.isPopup = false;
  13. }
  14. }, $htmlEl);
  15. }
  16. };
  17. }])