使用IOS 8.3在Safari上进行Angular ng-click问题 [英] Angular ng-click issues on Safari with IOS 8.3

查看:304
本文介绍了使用IOS 8.3在Safari上进行Angular ng-click问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个奇怪的问题,这是一些难以生成和探索的问题。

This is a weird issue, that is some what hard to generate and explore.

在使用Angular构建网络应用程序时,我的老板发现所有按钮在使用 ng-click 指令的应用程序无效。

While building a web-app using Angular, my boss found that all the buttons on the app that are using ng-click directive are not working.

现在,此问题仅发生在带有IOS 8.3的iphone 6并使用Safari浏览器

Now, this issue only happens on iphone 6 with IOS 8.3 and using the safari browser.

我可以说在iPhone5上测试的时候(所有版本) ),iPhone 6(IOS 9),Safari for Windows和所有其他浏览器(移动和桌面), ng-click 就像魅力一样。

I can say that when was tested on iPhone5 (All versions), iPhone 6 (IOS 9), Safari for windows and all other browsers (Mobile and desktop), ng-click works like a charm.

该应用程序正在使用 Angular 1.4.3 构建。

The app is being build using Angular 1.4.3.

这是你可以看到按钮的代码没什么特别的:

This is the code for the button, as you can see, nothing special about it:

<button class="btn calculate-button" ng-click="onCalculate()">Calculate</button>

在控制器中:

$scope.onCalculate = function () {
     //Do something... And then:
     $state.go('someplace');
};




我尝试了很多这里建议的更改,包括 ng-touch ng-bind ,构建我自己的click指令,如下所示:



I tried many changes that were suggested here, including ng-touch, ng-bind, building my own click directive as follows:

.directive('basicClick', function($parse, $rootScope) {
    return {
        compile: function(elem, attr) {
            var fn = $parse(attr.basicClick);
            return function(scope, elem) {
                elem.on('click', function(e) {
                    fn(scope, {$event: e});
                    scope.$apply();
                });
            };
        }
    };
});

无法找到解决问题的正确方法。

Couldn't find any proper solution for the problem.

谢谢。

推荐答案

我最终修好了它。

问题出在 //做某事......然后:部分功能。
在此过程中的某个时刻,该功能会将一些数据保存到浏览器本地存储中。

The problem was in the //Do something... And then: part of the function. At some point along the way, that function saves some data to the browser local storage.

我的老板在Safari上使用隐私浏览,显然在使用时私密浏览Safari,浏览器不会保存和本地存储上的数据,它会引发异常并杀死代码。

My boss was using private browsing on safari, and apparently when using private browsing on safari, the browser wont save and data on the local storage and it throws an exception and kills the code.

好吧,谢谢你。

这篇关于使用IOS 8.3在Safari上进行Angular ng-click问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆