我在Angular2
中Observables
有點新。根據我的理解,只要數據發生變化,他們就會將更改發佈到subscribers
。我實際上從我的php
後端獲得第一個響應初始運行。來自PHP的角度2觀察對象
但是,如果我的數據庫
the observable cant fetch the next changes again. It will only update upon refresh
我的服務
checkField(_options : T):Observable<any>{
this.options = _options;
let x = this.serialize(this.options);
let headers = new Headers({'Content-Type':'application/x-www-form-urlencoded'});
let options = new RequestOptions({ headers: headers});
return this.http.post("http://zodiark.co.nf/php/check_id.php" , x , options).map(this.extractData).catch(this.handleError);
}
我的組件
regChecker.checkField(this.checkerOption).subscribe(
(data) => { this.testObserver = data; console.log(this.testObserver)
})
上更改或更新的東西
我只是需要澄清,如果這是可能的。
PS。在此先感謝。
謝謝。我使用'Observable.interval'獲得了可觀察的廣播時間。我明白你想表達的意思。我以爲我可以做一些AngularFire2,我之前嘗試過,直接更改數據庫會反映在客戶端上。但再次感謝。 –
哦,是的,Firebase不僅僅是一個簡單的HTTP請求;) – Amit
問題是我需要使用桌面版本的現有網站。所以我的Ionic應用程序應該用'php'> _ <來獲取這個數據庫。悲傷的生活哈哈 –