On next click emitting value to observable able to get but it getting called n number of times first it is getting empty value next getting the object. so i need to write a if condition and in that if value is not empty then perform some logic. so is there any way to get the finally completed value so tried rxjs operator like last take(1) and behaviour subject but none of them working attach code snippet is anything is wrong in writing observable
savePersonalInfo$ = new Subject<any>();
get savePersonalInfo() {
return this.savePersonalInfo$.asObservable();
}
my service file looks like this where creating a subject tried with behaviour subject but no luck.
onClickedNext(){
// this.isContinueClicked = true;
// this.shared.coapplicantForm = this.register;
this.shared.isFromNext = true;
this.shared.savePersonalInfo$.next({value: 'clicked'});
}
on next click event where emitting the value so it is from navigation component.
this.shared.savePersonalInfo.subscribe(resp => {
if (resp.value != "") {
}
});
code trying to get the emitted value here it needs to get the latest value initially its getting empty this is other component where on next click need to save data in personal component so writing if condition whether data is available so in other place in code it sends object how to differentiate in that case since it gets object.
filter(Boolean),skip(1)orfilter(whatever logic)operators. - martin