我在打字稿中读到一个静态构造函数,并自己尝试了一下,但是它不起作用。我想以此初始化一个静态变量-该方法只能被调用一次。
错误:“静态”修饰符无法出现在构造函数声明中。
码:
export class DataManagement {
private static subjects: string[];
static constructor() {
DataManagement.subjects = [];
//some more code here
}
Run Code Online (Sandbox Code Playgroud)
}
我向服务器发出一个 post 请求,该请求响应两个对客户端很重要的标头:用户名和访问令牌。Chrome 调试工具的网络选项卡显示以下响应数据:

这里没有标题 - 为什么会这样?我的日志代码:
this.usersService.registerNewUser(firstName, lastName, email, username, birthday, password).subscribe(
res => {
console.log(res);
},
err => {
console.log("Error" + JSON.stringify(err));
}
);
Run Code Online (Sandbox Code Playgroud)
我想通过res.headers.username.
我的请求是这样的:
this.http.post<string>(
"http://localhost:2002/users",
JSON.stringify({
firstName: firstName,
lastName: lastName,
email: email,
username: username,
birthday: birthday,
password: password
}),
{
observe: "response"
}
);
Run Code Online (Sandbox Code Playgroud)
我做错了什么?
我有一个带有cmd命令转发输出的文件.AC程序循环遍历字符,直到它到达文件末尾.但不幸的是,在文件实际结束之前,文件中有一些EOF指示符.该文件的内容是:
Abbildname PID Sitzungsname Sitz.-Nr. Speichernutzung
========================= ======== ================ =========== ===============
System Idle Process 0 Services 0 8 K
System 4 Services 0 5ÿ744 K
smss.exe 440 Services 0 276 K
csrss.exe 616 Services 0 1ÿ924 K
wininit.exe 720 Services 0 944 K
services.exe 792 Services 0 7ÿ892 K
lsass.exe 800 Services 0 14ÿ300 K
svchost.exe 924 Services 0 420 K
fontdrvhost.exe 952 Services 0 680 K
svchost.exe 960 Services 0 23ÿ880 K
WUDFHost.exe 1012 Services 0 7ÿ416 K
svchost.exe …Run Code Online (Sandbox Code Playgroud) 我的@Output或父组件中的事件至少有问题。父HTML:
<h1>Accountmanagement</h1>
<button class="add" (click)="onAddEmployee()">Add Employee</button>
<table>
<tr>
<th>Username</th>
<th>E-Mail</th>
<th>Discord</th>
<th>First Name</th>
<th>Forum</th>
<th>Gitlab</th>
<th>Redmine</th>
<th>Gameserver</th>
<th>Docu-Server</th>
</tr>
</table>
<div class="overlay" *ngIf="showOverlay"></div>
<br>
<br>
<div class="interface" *ngIf="showOverlay">
<employee-dialog [employee]="employee" (end)="onEnd($event)"></employee-dialog>
</div>
Run Code Online (Sandbox Code Playgroud)
家长TS:
import { Component } from '@angular/core';
import { Employee } from '../../Dataclasses/Employee';
import { EmployeeDialog } from './EmployeeDialog/EmployeeDialog';
@Component({
selector: 'employee-list',
templateUrl: 'EmployeeList.html',
styleUrls: ["EmployeeList.css"]
})
export class EmployeeList {
employees: Employee[];
employee: Employee = new Employee();
showOverlay: boolean = false; //if the overlay and popup is …Run Code Online (Sandbox Code Playgroud) javascript ×3
angular ×2
typescript ×2
batch-file ×1
c ×1
cmd ×1
constructor ×1
events ×1
html ×1
http ×1
post ×1
request ×1
static ×1
stream ×1