在Chrome和Firefox中获取ERR_CONNECTION_REFUSED?
我正在开发Angular2网站。它在IE中正常工作,但在Chrome和Firefox中出现ERR_CONNECTION_REFUSED错误。在Chrome和Firefox中获取ERR_CONNECTION_REFUSED?
下面是我的代码:
下面是我的home.component.html:
<div class="log_wrap"> <div class="log_img"></div>
<ul class="log_list">
<li>USER ID<br>
<input class="log_input" placeholder="Login ID" id="LoginID" type="text">
</li>
<li>PASSWORD<br>
<input class="log_input" placeholder="*******" id="password" type="password">
</li>
<li>
<input type="button" class="reset_but" value="Reset"/>
<input type="button" class="log_but" value="Login" (click)="login_btnClick()"/>
</li>
</ul>
</div>
下面是我的home.component.ts:
export class HomeComponent { homes: IHome[];
home: IHome;
msg: string;
indLoading: boolean = false;
constructor(private fb: FormBuilder, private _homeService: HomeService, private router: Router) { }
login_btnClick() {
var Domain = "sgl";
var Username = ((document.getElementById("LoginID") as HTMLInputElement).value);
var Password = ((document.getElementById("password") as HTMLInputElement).value);
this._homeService.get(Global.BASE_USER_ENDPOINT + '/ValidateEmployee?Domain=' + Domain + '&Username=' + Username + '&Password=' + Password)
.do(data => sessionStorage.setItem('session', Username))
.subscribe(homes => {
this.homes = homes;
this.indLoading = false;
var NT = sessionStorage.getItem('session');
//this.router.navigateByUrl('/user');
this.EmpDetails();
},
error => this.msg = <any>error);
}
}
以下是我的home.ts:
export interface IHome { EmpName: string,
EmpNumber: string,
EmailId: string,
Id: number,
FirstName: string,
LastName: string,
Gender: string
}
而下面是我的home.service.ts:
export class HomeService { constructor(private _http: Http) { }
get(url: string): Observable<any> {
return this._http.get(url)
.map((response: Response) => <any>response.json())
//.do(data => console.log("All: " + JSON.stringify(data)))
.catch(this.handleError);
}
这个代码在IE工作完美,它不是在谷歌Chrome和Firefox.I'm工作得到ERR_CONNECTION_REFUSED错误。
这里是我的角cli.json: 角cli.json
{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "i-roz-ui"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"class": {
"spec": false
},
"component": {
"spec": false
},
"directive": {
"spec": false
},
"guard": {
"spec": false
},
"module": {
"spec": false
},
"pipe": {
"spec": false
},
"service": {
"spec": false
}
}
}
回答:
请尝试运行与参数铬: - 禁用网络安全
以上是 在Chrome和Firefox中获取ERR_CONNECTION_REFUSED? 的全部内容, 来源链接: utcz.com/qa/261277.html