Angular 4在IE11中不起作用

时间:2018-05-09 11:04:26

标签: angular webpack angular-ui-router

我正在开发一个角度4的应用程序,当我用chrome,firefox或边缘浏览器打开它时没有出现问题,但是当我用ie打开它时它会在浏览器中显示我的错误&# 39; s控制台

  

SCRIPT1003:':' attendu common.chunk.js(922,22)

     

错误错误:未捕获(在承诺中):错误:加载块常见   失败。错误:加载块常见失败。在匿名功能   (http://localhost:8091/vendor.bundle.js:219834:17)at   CatchSubscriber.prototype.error   (http://localhost:8091/vendor.bundle.js:136912:17)at   Subscriber.prototype._error   (http://localhost:8091/vendor.bundle.js:134986:9)at   Subscriber.prototype.error   (http://localhost:8091/vendor.bundle.js:134960:13)at   OuterSubscriber.prototype.notifyError   (http://localhost:8091/vendor.bundle.js:134456:9)at   InnerSubscriber.prototype._error   (http://localhost:8091/vendor.bundle.js:134005:9)at   Subscriber.prototype.error   (http://localhost:8091/vendor.bundle.js:134960:13)at   Subscriber.prototype._error   (http://localhost:8091/vendor.bundle.js:134986:9)at   Subscriber.prototype.error   (http://localhost:8091/vendor.bundle.js:134960:13)at   Subscriber.prototype._error   (http://localhost:8091/vendor.bundle.js:134986:9

     

SCRIPT5022:SecurityError polyfills.bundle.js(5766,25)

polyfills.ts

import 'core-js/es6/symbol';
import 'core-js/es6/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/es7/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';

app.routes.ts

import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';

export const routes: Routes = [
  { path: '', redirectTo: 'convention', pathMatch: 'full' },
  { path: 'network', loadChildren: './module/network/network.module#NetworkModule' },
  { path: 'convention', loadChildren: './module/convention/convention.module#ConventionModule' },
  { path: '**', redirectTo: 'convention' }
];

export const appRoutes: ModuleWithProviders = RouterModule.forRoot(routes, { useHash: true, preloadingStrategy: PreloadAllModules });

app.module.ts

@NgModule({
  imports: [
    CommonModule,
    CoreModule.forRoot(),
    NgbModalModule.forRoot(),
    appRoutes,
    StoreModule.forRoot(fromRoot.reducers),
    EffectsModule.forRoot([]),
    StoreDevtoolsModule.instrument({ maxAge: 50 })
  ],
  declarations: [
    ...APP_COMPONENT
  ],
  providers: [
    { provide: LocationStrategy, useClass: PathLocationStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

index.html

<!DOCTYPE html>
<html>

<head>
  <title></title>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">
  <base href="/">
</head>

<body>
  <app-root>
    <div class="loader loader-site">
      <div class="logo-beidys-loader"></div>
    </div>
  </app-root>
</body>

</html>

1 个答案:

答案 0 :(得分:-2)

在index.html中添加元标记。这也是一条必要的路线。

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

请参阅https://stackoverflow.com/a/6771584/7458082  更多信息。

相关问题