I am using observable in
service
getMembers(): Observable<any[]> {
return this._http.get('http://localhost/membership/main/getUsers')
.map(response => response.json() );
}
component
members$: Observable<any[]>;
ngOnInit() {
this.members$ = this._membersService.getMembers()
}
requests
-getUsers
-getUsers
both return the same JSON data
every time I load the page it returns a duplicate request. it is not about the hot and cold request. because both requests return the same response. but when I remove the observable, everything is ok. only one request
members$|async
in template 2 times - Danil Gudz