Windows 플랫폼에서 alert 객체가 지원되지 않아서 Ionic Popup객체로 대체...


var alert = window.alert;


angular.module('myApp', ['ionic'])

.controller('myCtrl', function ($scope, $state, $timeout,$ionicPopup) {
    alert = function (messageText, titleText) {
        if (!titleText || titleText == "undefined") {
            titleText = "";
        }
        var alertPopup = $ionicPopup.alert({
            title: titleText,
            template: messageText
        });
        alertPopup.then(function (res) { });
    };

});



출처 : 자작(userpark.net)


출처 : https://github.com/driftyco/ionic/issues/2885



window.addEventListener('click', function(event) {
  if (Object.prototype.toString.call(event) == '[object PointerEvent]') {
    event.stopPropagation();
  }
}
, true);


또는


ionic.Platform.isIE = function () {
    return ionic.Platform.ua.toLowerCase().indexOf('trident') > -1;
}

if (ionic.Platform.isIE()) {
    angular.module('ionic')
      .factory('$ionicNgClick', ['$parse', '$timeout', function ($parse, $timeout) {
          return function (scope, element, clickExpr) {
              var clickHandler = angular.isFunction(clickExpr) ? clickExpr : $parse(clickExpr);

              element.on('click', function (event) {
                  scope.$apply(function () {
                      if (scope.clicktimer) return; // Second call
                      clickHandler(scope, { $event: (event) });
                      scope.clicktimer = $timeout(function () { delete scope.clicktimer; }, 1, false);
                  });
              });

              // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click
              // something else nearby.
              element.onclick = function (event) { };
          };
      }]);
}


'Language > Mobile' 카테고리의 다른 글

[Hybrid/Ionic]Windows Platform에서 alert 객체 대체  (1) 2016.11.04

+ Recent posts