I am developing some code where as long as a checkbox is true some inputs will calculate some values and modify other inputs so i came to a solution like this
// boolean observable
this.toggleObservable.subscribe((value)=>{
if (value) {
this.dataService.calculateValuesObservable.subscribe(...logic that changes the values reactively)
}
})
the problem is when i set the toggle off i cant unsubscribe from calculateValuesObservable
any suggestions?