0

I declared an Observable:

  isOn: Observable<boolean>;

in onInit I did:

this.isOn = this.manager.currentState.map(state => state === StateType.typeOn);

and now I wanted to be able to update some input in the html file so to be able to sample it I understood I need to subscribe to it so I declared _currentState: Subscription; and added in the onInit:

this._currentState = this.isOn.subscribe(
      (retValue: Boolean) => {
        if (retValue) {
          this.curState = true;
        } else {this.curState = false;}
      }
    );

the problem occurs in the else right here above...its not setting the value to false.

and curState is what im questioning in my input to see it's value...but at certain action I did I didnt get the value I expected...

what am im doing wrong? im new to Observables so as much inputs I can get from you guys will help :) thanks

Joe
  • 2,543
  • 3
  • 25
  • 49

0 Answers0