我正在 angular7 中建立到我的系统的 http 连接。但是,它在模块中出错。当我创建 get 请求时会出现此消息:
Type 'Promise<any>' is missing the following properties from type 'User': id, user, email
Run Code Online (Sandbox Code Playgroud)
模块:
export class User {
id: number
user: string
email: string
}
Run Code Online (Sandbox Code Playgroud)
要求:
users: User;
this.userService.getUsers().subscribe(
response => {
if (!response) {
console.log(Error)
} else {
this.users = response
}
})
Run Code Online (Sandbox Code Playgroud)
Http获取:
getUsers() {
return this.service.get(this.endpoint)
.map((response) => {
return response;
});
}
Run Code Online (Sandbox Code Playgroud)
服务:
standardHeaders() {
const headers = new HttpHeaders();
headers.append('Content-Type', 'application/json');
if (this.authToken) {
headers.append('X-Authorization', this.authToken);
}
return …Run Code Online (Sandbox Code Playgroud) 我正在尝试向自定义操作添加按钮,但是该操作未添加新列,从而使按钮与其他按钮重叠。
码:
settings = {
actions: {
custom: [
{
name: 'Button',
title: 'Button ',
}
],
},
columns: {
name: {
title: 'Full name'
},
email: {
title: 'Email'
},
lastLogin: {
title: 'Last Login'
}
}
};
Run Code Online (Sandbox Code Playgroud)
我需要在图像上添加一个链接,因为我在这里的声誉不高,并且图像工具对我来说是被阻止的。
我究竟做错了什么?