1

How to get only latest value from subscribe in angular 4?

this.AbcSrvice.value.subscribe(data => {console.log(data)})
danday74
  • 45,909
  • 39
  • 198
  • 245

1 Answers1

2

Use the last operator : https://www.learnrxjs.io/operators/filtering/last.html

import { last } 'rxjs/operators';


this.AbcSrvice.value
.pipe(last())
.subscribe(data => {console.log(data)});
David
  • 31,489
  • 10
  • 78
  • 113