小编The*_*mer的帖子

静态构造函数打字稿

我在打字稿中读到一个静态构造函数,并自己尝试了一下,但是它不起作用。我想以此初始化一个静态变量-该方法只能被调用一次。

错误:“静态”修饰符无法出现在构造函数声明中。

码:

export class DataManagement {
private static subjects: string[];

static constructor() {
    DataManagement.subjects = [];
    //some more code here
}
Run Code Online (Sandbox Code Playgroud)

}

javascript static constructor initialization typescript

9
推荐指数
2
解决办法
4925
查看次数

无法以角度 5 获取响应标头

我向服务器发出一个 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)

我做错了什么?

javascript post http request angular

3
推荐指数
1
解决办法
3689
查看次数

在实际EOF之前的cmd的转发输出中的文件结尾

我有一个带有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)

c cmd batch-file stream

1
推荐指数
1
解决办法
71
查看次数

角度输出不起作用-instance [output.propName] .subscribe不是函数

我的@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)

html javascript events typescript angular

1
推荐指数
1
解决办法
487
查看次数