Angular 5(IE11)错误:未捕获(承诺):错误:无法匹配任何路由

侠客

我几天在Angular 5中遇到IE11的麻烦。我打开了polyfills:

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" />

当我开始使用ng serve项目时,一切都正常但是当我使用--prod选项构建项目时,应用程序无法在IE11中运行。Firefox和Chrome正常运行。

控制台日志:

    ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'gui/account'
    Error: Cannot match any routes. URL Segment: 'gui/account'
       at Anonymous function (http://localhost:8080/gui/main.d12ff1833b14b6308efb.bundle.js:1:401190)
       at e.prototype.error (http://localhost:8080/gui/main.d12ff1833b14b6308efb.bundle.js:1:386643)
       at e.prototype._error (http://localhost:8080/gui/main.d12ff1833b14b6308efb.bundle.js:1:7955)
       at e.prototype.error (http://localhost:8080/gui/main.d12ff1833b14b6308efb.bundle.js:1:7661)
       at e.prototype._error (http://localhost:8080/gui/main.d12ff1833b14b6308efb.bundle.js:1:7955)
       at e.prototype.error (http://localhost:8080/gui/main.d12ff1833b14b6308efb.bundle.js:1:7661)
       at e.prototype._error (http://localhost:8080/gui/main.d12ff1833b14b6308efb.bundle.js:1:7955)
       at e.prototype.error (http://localhost:8080/gui/main.d12ff1833b14b6308efb.bundle.js:1:7661)
       at e.prototype._error (http://localhost:8080/gui/main.d12ff1833

SCRIPT5011: Can't execute code from a freed script
File: polyfills.6460c1711c3b9abc371d.bundle.js, Line: 1, Column: 69035

当我尝试调试它时,polyfills.bundle.js中出现一些错误:

IE11调试屏幕截图

非常感谢您的帮助。

侠客

我终于找到了导致此问题的原因。我正在从Spring应用程序webapp / gui文件夹提供Angular应用程序这导致路由器表现异常,解决方案是将index.html中的base href更改

<base href="#/">

<base href="/gui/">

这样,我的Angular Spring控制器会将链接http:// localhost:8080 / gui / account重定向到Angular index.html。然后,Angular路由器将选择此链接并重定向到/ account组件。

这可能与缺陷https://github.com/angular/angular/issues/18176有关

我希望这也会对你们有所帮助。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

错误错误:未捕获(承诺),无法匹配任何路由。URL段

错误:未捕获(承诺):错误:无法匹配任何路线Angular 2

例外:未捕获(承诺):错误:无法匹配任何路由。网址细分:“详细信息”

未捕获(承诺):错误:无法匹配任何路由:''

Angular 4-新的MouseEvent导致IE11错误

错误:未捕获(承诺):错误:无法匹配任何路由。网址段:“ site-notice”

Angular 2 Testing组件给出“错误:未捕获(承诺):错误:模板解析错误”

Angular 6.1.9嵌套到命名插座的路由-“无法匹配任何路由”错误

错误:无法匹配Angular 5中的任何路线

错误错误:未捕获(承诺):错误:无法匹配任何路由。URL段:'列表'错误:无法匹配任何路由。网址段:“列表”

错误错误:未捕获(承诺):错误:无法匹配任何路由。网址段:“主要/基于知识库”

Internet Explorer和Angular 6错误错误:未捕获(按承诺):错误:正在加载块

错误错误:未捕获(承诺):错误:无法匹配任何路由。网址段:“员工” E

Nativescript-angular2未捕获(承诺):错误:无法匹配具有多个嵌套路由的任何路由

Angular 7-错误错误:未捕获(承诺):TypeError:无法读取未定义的属性“ forEach”

如何解决错误:未捕获(承诺):错误:无法匹配任何路由。网址段:“ ****”

例外:错误:未捕获(承诺中):错误:无法匹配任何路由:“”

错误:未捕获(承诺):错误:无法匹配任何路由RC4子路由

Angular2例外:错误:未捕获(按承诺):错误:无法匹配任何路由:

错误:未捕获(承诺):错误:无法匹配任何路由(RC4)

angular2 *ngFor 对象数组 IE11 错误

错误错误:未捕获(承诺):类型错误:无法在 ionic 4 Angular 中设置未定义的属性“设备”

间歇性错误无法匹配任何路由单元测试Angular

IONIC 4 + Angular7:错误错误:未捕获(承诺):类型错误:无法读取未定义的属性“then”

PLS HELP 错误错误:未捕获(承诺):错误:无法匹配任何路由。URL 段:'r2' 错误:无法匹配任何路由。URL 段:'r2'

延迟加载导致错误错误:未捕获(承诺):错误:无法匹配任何路由。网址段:

角度错误:未捕获(承诺):错误:无法匹配任何路由

如何修复未捕获的错误(承诺):错误:在 Material Angular 表中单击带有导航的行时无法匹配任何路线?

Angular HTTP 获取请求 - 错误错误:未捕获(承诺):