我有一个跨平台的 Ionic 应用程序, 我在 ionic view 应用程序 View 中遇到一些问题,该 View 对于 APK 版本运行正确
第一个问题:我使用 socket.io 来检查用户互联网连接,它在 IOS 9 上始终失败,尽管它在 Android 6 的 ionic view 版本和 APK 版本上运行良好
第二个问题:图标在 Android 6 和 IOS 9 上不可点击,尽管它是 APK 版本
<i class="icon ion-ios-download-outline"
external-link="result.file.uri"></i>
external-link
是指向点击链接的指令重定向
它适用于 APK 版本
有什么帮助吗?
** 编辑
externalLink指令代码
angular.module('ivf.directives').directive('externalLink', ExternalLinkDirective);
function ExternalLinkDirective() {
return {
restrict: 'A',
scope: false,
link: function ($scope, $element, $attrs) {
$element.click(function ($event) {
if ($event.isDefaultPrevented()) return;
var link = $scope.$eval($attrs['externalLink']);
if (link) {
window.open(link, '_system');
}
});
}
}
}
最佳答案
第一
要检查互联网连接,您可以使用 Cordova Plugin Network Information .
function checkConnection() {
var networkState = navigator.connection.type;
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.CELL] = 'Cell generic connection';
states[Connection.NONE] = 'No network connection';
alert('Connection type: ' + states[networkState]);
}
checkConnection();
第二
您指的是哪些图标?请出示您的代码
关于android - Ionic 在 android 6 和 IOS 9 中的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39774766/