InAppBrowser passing a callback function

后端 未结 1 1837
眼角桃花
眼角桃花 2021-01-15 22:33

I have a InAppBrowser working fine in my app

$scope.openInAppBrowser = function (url) {
        var ref = window.open(encodeURI(url), \'_blank\', \'location=         


        
相关标签:
1条回答
  • 2021-01-15 22:49

    Just use angular $apply() method to change the value of angular variables because it is changed out of angularjs turn.

    $scope.openInAppBrowser = function (url) {
            var ref = window.open(encodeURI(url), '_blank', 'location=yes');
            ref.addEventListener('loadstop', function (event) {
                if (event.url.match("close")) {
                    $scope.$apply(function () {
                    $scope.refreshGamePage = 1;
                  });
                    ref.close();
                }           
            });
        }
    
    0 讨论(0)
提交回复
热议问题