I have this simple method in my service :
notify(userID: string) { let _URL = this.baseUrl + '/notification/GetUnseen?userId=' + userID; this.datatService.set(_URL); return this.datatService.get() .flatMap((response) => response.json().slice()) .distinct(); } It return a stream of object which contain informations about user's notification. i would like to execute this call every 5 second with interval operator without using setTimeout ?
When i try this :
notify(userID: string) { let _URL = this.baseUrl + '/notification/GetUnseen?userId=' + userID; this.datatService.set(_URL); return this.datatService.get() **.interval(5000)** .flatMap((response) => response.json().slice()) .distinct(); } I have an error. Any Suggestion ?