角仅在chrome上有效,但在Firefox边缘或IE11上有效

问题描述 投票:-1回答:1

在我的angular 8.0项目开发模式下,使用angular CLI。

仅适用于chrome,一切正常,但不适用于firefox / edge / IE11。

[当我在firefox / Edge中打开项目时,我在登录页面中存储了,我输入我的帐户/密码,然后单击login,什么都不会发生,F12中没有错误或消息。

当我在IE11中打开项目时,只有白页,也没有错误或消息。

请帮助我怎么做,

[我发现有人说在polyfills中导入es6-slim或reflict.js,但它也不起作用。


我的package.json{ "name": "std-web", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "~8.2.6", "@angular/cdk": "~8.2.0", "@angular/common": "~8.2.6", "@angular/compiler": "~8.2.6", "@angular/core": "~8.2.6", "@angular/flex-layout": "^8.0.0-beta.27", "@angular/forms": "^8.2.6", "@angular/material": "^8.2.0", "@angular/platform-browser": "~8.2.6", "@angular/platform-browser-dynamic": "~8.2.6", "@angular/router": "~8.2.6", "@ngx-formly/bootstrap": "^5.4.2", "@ngx-formly/core": "^5.4.2", "@ngx-formly/material": "^5.4.2", "bootstrap": "^4.3.1", "hammerjs": "^2.0.8", "ng-zorro-antd": "^8.3.0", "rxjs": "~6.5.3", "tslib": "^1.9.0", "zone.js": "~0.10.2" }, "devDependencies": { "@angular-devkit/build-angular": "~0.803.4", "@angular/cli": "~8.3.4", "@angular/compiler-cli": "~8.2.6", "@angular/language-service": "~8.2.6", "@types/jasmine": "~3.4.0", "@types/jasminewd2": "~2.0.3", "@types/node": "~12.7.5", "codelyzer": "^5.0.0", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.3.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage-istanbul-reporter": "~2.1.0", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.0", "protractor": "~5.4.0", "ts-node": "~8.4.1", "tslint": "~5.20.0", "typescript": "3.5.3" } }


我的登录页面组件

`completeSetup():void {

//console.log(data);
this.loginService.postAccountInfo(this.username,this.password)
  .subscribe(res=>{ 
    this.obj = res 
    this.store.set(INIT_FLAG, true);
    this.store.set(USERNAME, this.username);
    this.store.set(AUTHTOKEN,this.obj.authToken);
    console.log("login sucess");
    this.router.navigateByUrl('main/sc/candidate');

  },(error)=>{
    this.checkAuth=true;
    console.log(error);
  }
  );

}`

我的登录服务

`postAccountInfo(用户名,paswword){

//AuthInfo:AuthInfo;

return this.http.post("/um/login", {
  observe: "response",
  userName:username,
  password:paswword,
  groupId:"1234",
  orgId:"ykdemo"
}).pipe(
  catchError(this.handleError)
);

}`

angular cross-browser polyfills
1个回答
0
投票

您需要编辑浏览器列表文件,并在此配置文件中允许IE11。如果使用Angular CLI项目,则会自动创建此文件。只需打开文件,文件包含如下-

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

按照上述说明,仅从最后一行删除not关键字,然后尝试。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.