如何克服Angular 5的IE错误:加载块失败

时间:2018-07-23 16:35:21

标签: javascript angular

在IE中加载带有ng2-smart-table的表时遇到问题。 除IE 11以外,它在所有其他浏览器中都可以正常工作。已经添加了polyfills,但似乎无济于事:

Error

"dependencies": {
"@amcharts/amcharts3-angular": "^2.1.1",
"@angular/animations": "^5.2.11",
"@angular/common": "~5.2.6",
"@angular/compiler": "~5.2.6",
"@angular/core": "~5.2.6",
"@angular/forms": "~5.2.6",
"@angular/http": "~5.2.6",
"@angular/platform-browser": "~5.2.6",
"@angular/platform-browser-dynamic": "~5.2.6",
"@angular/router": "~5.2.6",
"@nebular/auth": "^2.0.0-rc.7",
"@nebular/security": "^2.0.0-rc.7",
"@nebular/theme": "^2.0.0-rc.7",
"@ng-bootstrap/ng-bootstrap": "1.0.0",
"@ngx-translate/core": "^8.0.0",
"@ngx-translate/http-loader": "^3.0.1",
"@swimlane/ngx-charts": "^8.1.0",
"@syncfusion/ej2-charts": "^16.2.41",
"@syncfusion/ej2-grids": "^16.2.41",
"@syncfusion/ej2-maps": "^16.2.41",
"@syncfusion/ej2-ng-maps": "^16.2.41",
"@types/plotly.js": "^1.38.3",
"amstock3": "amcharts/amstock3",
"angular-mat-datepicker": "0.0.2",
"angular2-chartjs": "^0.5.1",
"angular2-moment": "^1.9.0",
"bootstrap": "4.0.0",
"classlist.js": "^1.1.20150312",
"core-js": "2.5.1",
"date-fns": "^1.29.0",
"dateformatter": "^0.1.0",
"echarts": "^4.1.0",
"express": "^4.16.3",
"font-awesome": "^4.7.0",
"ify-loader": "^1.1.0",
"intl": "^1.2.5",
"ionicons": "2.0.1",
"moment": "^2.22.2",
"nebular-icons": "1.0.6",
"ng2-select": "^2.0.0",
"ng2-smart-table": "^1.2.2",
"ngx-echarts": "^2.1.0",
"normalize.css": "6.0.0",
"pace-js": "1.0.2",
"plotly.js": "^1.38.3",
"primeng": "^6.0.0-alpha.1",
"roboto-fontface": "0.8.0",
"rxjs": "5.5.5",
"socicon": "3.0.5",
"typeface-exo": "0.0.22",
"web-animations-js": "^2.2.5",
"zone.js": "0.8.18"},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.8",
"@angular/cli": "^6.0.8",
"@angular/compiler-cli": "~5.2.6",
"@angular/language-service": "~5.2.6",
"@compodoc/compodoc": "1.0.1",
"@types/jasmine": "2.5.54",
"@types/jasminewd2": "2.0.3",
"@types/node": "6.0.90",
"babel-preset-angular2": "0.0.2",
"babel-preset-es2015": "^6.24.1",
"codelyzer": "3.2.1",
"conventional-changelog-cli": "1.3.4",
"husky": "0.13.3",
"jasmine-core": "2.6.4",
"jasmine-spec-reporter": "4.1.1",
"karma": "1.7.1",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.3.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"npm-run-all": "4.0.2",
"protractor": "5.1.2",
"rimraf": "2.6.1",
"stylelint": "7.13.0",
"ts-node": "3.2.2",
"tslint": "5.7.0",
"tslint-language-service": "0.9.6",
"typescript": "2.5.3"}

app.module:

import { APP_BASE_HREF } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { CoreModule } from './@core/core.module';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { ThemeModule } from './@theme/theme.module';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { LoginComponent } from './login/login.component';
import { LoginService } from './@core/data/login.service';
import { LogoutComponent } from './logout/logout.component';
import { MessageService } from 'primeng/components/common/messageservice';
import { GrowlModule } from 'primeng/growl';
import { RegisterComponent } from './register/register.component';
import { RegisterService } from './@core/data/register.service';
import { CountryListService } from './@core/data/countryList.service';
import { DropdownModule } from 'primeng/dropdown';
import { AuthGuard } from './auth-guard.service';
import { ForgotPasswordComponent } from './login/forgotPassword/forgotPassword.component';
import { ForgetPasswordService } from './@core/data/forgotPassword.service';


// AoT requires an exported function for factories
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient);}

 @NgModule({
declarations: [AppComponent,
LoginComponent,
ForgotPasswordComponent,
RegisterComponent,
LogoutComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AppRoutingModule,
NgbModule.forRoot(),
ThemeModule.forRoot(),
CoreModule.forRoot(),
TranslateModule.forRoot({
  loader: {
    provide: TranslateLoader,
    useFactory: HttpLoaderFactory,
    deps: [HttpClient]
  }
}),
GrowlModule,
DropdownModule],
bootstrap: [AppComponent],
providers: [
{ provide: APP_BASE_HREF, useValue: '/' },
LoginService, RegisterService, MessageService, AuthGuard, 
CountryListService, ForgetPasswordService
],
entryComponents:[
ForgotPasswordComponent
]
})
export class AppModule {
}

tsconfig.json:

{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
  "node_modules/@types"
],
"lib": [
  "es2017",
  "dom"

],
"plugins": [
  { "name": "tslint-language-service"}
],
"types": [
  "plotly.js"
],"paths": {
  "plotly.js": [
    "../node_modules/plotly.js/dist/plotly-basic.js"
  ]
}
}
}

任何人都可以提出修复建议吗?我已经取消对pollyfills.ts文件的注释,但似乎无济于事。 如果您需要其他代码,请询问

0 个答案:

没有答案