Angular路由在CordovaiOS上不起作用
创始人
2024-10-28 05:30:55
0

在Cordova iOS中,需要使Angular路由与InAppBrowser兼容。要实现这一点,请将以下代码添加到app.js文件中:

app.config(['$provide', function($provide) { $provide.decorator('$browser', ['$delegate', function($delegate) { if (window.cordova) { // Device return function() { return { poll: function() {}, // This is not a proper implementtaion, but it is enough for demostration // purposes. It only checks whether Cordova is already loaded by requesting // it on the window object. // Note: in iOS the local file system requests do not work, so you have to // add 'file://' to your whitelist to let them work. // If you are using InAppBrowser plugin, you should skip the whitelist and // use the cordova.InAppBrowser.open() method. navigate: function(url) { if (url !== 'about:blank') { window.location.href = url; } } }; }; } return $delegate; }]); }]);

这将装饰Angular的$browser服务并更改其导航方法,使其使用InAppBrowser插件而不是默认窗口方法。以这种方式更改后,Angular路由在Cordova iOS上应该起作用。

相关内容

热门资讯

科技介绍!we-poker辅助... 此外,数据分析德州(we-poker辅助软件教程)辅助神器app还具备辅助透视行为开挂功能,通过对客...
解密关于!wepoker软件安... 解密关于!wepoker软件安装包,epoker底牌透视,详细教程(有挂透明)关于wepoker软件...
玩家必看科普!哈糖大菠萝怎么挂... 《玩家必看科普!哈糖大菠萝怎么挂,hardrock透视工具,新2025版(有挂技巧)》 哈糖大菠萝怎...
六分钟了解!WePoKer辅助... 六分钟了解!WePoKer辅助器,wepoker透视脚本免费下载pc,教你攻略(有挂透视)准备好在w...
总算明白!wepoker怎么下... 总算明白!wepoker怎么下载游戏,pokemmo手机版透视脚本,爆料教程(有挂神器);《WPK辅...
一分钟了解!竞技联盟透视,we... 一分钟了解!竞技联盟透视,wepoker怎么看牌型,可靠教程(有挂教程);支持多人共享记分板与复盘,...
重要通知!werplan外挂,... 1、重要通知!werplan外挂,wepoker可以免费玩吗,可靠教程(有挂攻略);详细教程。2、w...
分享一款!wepoker怎么挂... 分享一款!wepoker怎么挂飞机,有没有人wepoker,必备教程(有挂技巧);支持多人共享记分板...
技巧知识分享!菠萝辅助器免费版... 技巧知识分享!菠萝辅助器免费版的功能介绍,wepoker有辅助工具吗,详细教程(有挂技巧)是由北京得...
玩家必备攻略!we-poker... 玩家必备攻略!we-poker辅助软件教程,破解辅助插件wepoker,2025新版教程(有挂技巧)...