Angular 6 – IOS中的Chrome – 路由器问题

前端之家收集整理的这篇文章主要介绍了Angular 6 – IOS中的Chrome – 路由器问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在开发一个Angular 6网站,我只在 IOS(iPad,iPhone)的Chrome上面临一个奇怪的问题.

直接转到每个链接时,每个页面都会正确呈现.但是当我点击任何页面中的任何链接时,它会生成类似这样的NavigationError:

TypeError: Argument 1 ('other') to Node.contains must be an instance of Node
TypeError: Argument 1 ('node') to Node.insertBefore must be an instance of Node

在IOS中调试Chrome非常困难,因此很难获得更多信息.

我的网站在任何其他浏览器和操作系统,Firefox(Windows,Linux),Chrome(Windows和Linux),Safari(ios,osx,windows)上运行良好.

任何人都知道从哪里开始寻找?

谢谢!

解决方法

显然,当此代码存在时,问题仅发生在Google Chrome iOS上:

let script = window['document'].createElement('script');
script.setAttribute('type','text/javascript');
script.setAttribute('src','https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1');
window['document'].body.appendChild(script);
window['__onGCastApiAvailable'] = function (isAvailable) { /*Do chromecast initialization*/}

所以我添加了这个条件:

if(!navigator.userAgent.match('CriOS'))

问题解决了.

我真的不知道为什么cast框架会打破角度路由.

猜你在找的Angularjs相关文章