我似乎无法理解我在客户端应用程序上遇到的错误.我正在订阅graphql订阅,我能够检索更新,但我无法将更改推送到名为"models:ModelClass []"的视频脚本数组,该数组绑定到视图.
有什么我遗失或做错了吗?
models.component.ts
this.apollo.subscribe({
query: gql`
subscription {
newModelCreated{
_id
name
type
train_status
deploy_status
data_path
description
created_at
updated_at
}
}
`
}).subscribe((data) => {
console.log("CREATED: " + JSON.stringify(data.newModelCreated));
console.log(data.newModelCreated);
var temp:ModelClass = data.newModelCreated;
this.models.push(temp);
});
Run Code Online (Sandbox Code Playgroud)
模型class.ts
export interface ModelClass {
_id: string;
name: string;
type: string;
parameters: {
alpha: number;
};
train_status: string;
deploy_status: string;
test_accuracy: string;
created_at: number;
updated_at: number;
}
Run Code Online (Sandbox Code Playgroud)