React to Angular Signal without using signal state

1 day ago 1
ARTICLE AD BOX

I'm getting back into Angular for the first time since v8, and have been really liking using signals as a cleaner alternative to RxJS.

The one thing that appears to be missing is the Signal equivalent of a value change being able to trigger a callback without actually using any of the state provided by those signals.

For example the RxJS equivilant would be something like

const a$ = new BehaviorSubject<string>("val1"); const b$ = new BehaviorSubject<string>("val2"); merge([a$,b$]).subscribe(() => { this.event.emit() })

I know in React you can do something like the following

const [stateA, setStateA] = useState('val1'); const [stateB, setStateB] = useState('val2'); useEffect(() => { emitEvent(); }, stateA, stateB)

It seems like this isnt possible with Angular Signals? The effect() function doesn't allow you to manually define the dependencies, and the only way I would think to do it would be to arbitrarily retrieve the values inside the effect() and then not do anything? That seems messy.

Any pointers would be great!

Read Entire Article