Javascript 角度5(IE11)错误:未捕获(承诺中):错误:无法匹配任何路由
几天后,我在IE11上遇到了麻烦。我已启用“多边形填充”:Javascript 角度5(IE11)错误:未捕获(承诺中):错误:无法匹配任何路由,javascript,angular,typescript,internet-explorer-11,polyfills,Javascript,Angular,Typescript,Internet Explorer 11,Polyfills,几天后,我在IE11上遇到了麻烦。我已启用“多边形填充”: import 'core-js/es6/symbol'; import 'core-js/es6/object'; import 'core-js/es7/object'; import 'core-js/es6/function'; import 'core-js/es6/parse-int'; import 'core-js/es6/parse-float'; import 'core-js/es6/number'; import
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es7/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
并为IE设置元标记:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
当我尝试调试它时,polyfills.bundle.js中出现了一些错误:
非常感谢您的帮助。我终于找到了导致此问题的原因。我是从Spring应用程序webapp/gui文件夹提供Angular应用程序的。这导致路由器行为异常,解决方案是将index.html中的base href从
<base href="#/">
到
这样,我的Angular Spring控制器将重定向到Angular index.html的链接。然后角路由器将拾取此链接并重定向到/account组件
这可能与缺陷有关
我希望这也能对你们有所帮助。我只是在IE11使用Angular 6和Spring boot时遇到了同样的问题 我使用自己的工厂根据当前位置
window.location.pathname
提供APP\u BASE\u HREF
令牌解决了这个问题:
{
provide: APP_BASE_HREF,
useValue: window.location.pathname,
}
我还从index.html
中删除了标记以保持简洁
看
请参见这似乎源于同一个问题。可能是重复的谢谢,伙计。我刚刚在IE11中使用了“”
<base href="/gui/">
{
provide: APP_BASE_HREF,
useValue: window.location.pathname,
}