首页 > 解决方案 > Angular 6,HttpClient,检测后端的数据变化

问题描述

我有一个MessageService这样的:

import { HttpClient, HttpHeaders } from "@angular/common/http";

@Injectable({
    providedIn: "root"
})
export class MessageService {
    private BASE_URL = "http://10.1.1.190/EDSOData/Messages";

    constructor(private http: HttpClient) { }

    public update(parameters: Object) {
        const httpOptions = {
            headers: new HttpHeaders({
                "Content-Type": "application/json",
            })
        };

        return this.http.post(this.BASE_URL, parameters, httpOptions);
    }
}

update插入一条消息。如果应用程序有多个同时用户,我如何检测所有用户的更改?

标签: angularreal-timereal-time-updates

解决方案


推荐阅读