簡體   English   中英

Angular 4在IE11中不起作用

[英]Angular 4 not working in IE11

我正在使用angular 4應用程序,當我使用chrome,firefox或ie邊緣瀏覽器打開它時,它沒有任何問題,但是當我使用ie 11打開它時,它在瀏覽器控制台中顯示了此錯誤

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

錯誤錯誤:未捕獲(承諾):錯誤:加載大塊公用失敗。 錯誤:常見的加載塊失敗。 在訂閱服務器上的CatchSubscriber.prototype.error( http:// localhost:8091 / vendor.bundle.js:136912:17 )的匿名函數( http:// localhost:8091 / vendor.bundle.js:219834:17 )處在OuterSubscriber上的Subscriber.prototype.error( http:// localhost:8091 / vendor.bundle.js:134960:13 )上的prototype._error( http:// localhost:8091 / vendor.bundle.js:134986:9 ) prototype.notifyError( HTTP://本地主機:8091 / vendor.bundle.js:134456:9 )在InnerSubscriber.prototype._error( HTTP://本地主機:8091 / vendor.bundle.js:134005:9 )中的訂戶。 Subscriber.prototype._error( http:// localhost:8091 / vendor.bundle.js:134986:9 )上的prototype.error( http:// localhost:8091 / vendor.bundle.js:134960:13 )發生在Subscriber.prototype._error( http:// localhost:8091 / vendor.bundle.js:134986:9 )的prototype.error( http:// localhost:8091 / vendor.bundle.js:134960:13

腳本5022: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>

在index.html中添加元標記。 這也是必需的行。

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

有關更多信息,請參閱https://stackoverflow.com/a/6771584/7458082

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM