#Signal on template not updateing

6 messages · Page 1 of 1 (latest)

fossil gate
#

I am using an EventSource to update a signals value when messages come in.

The problem is on the html template. I am displaying the signal <p>{{item()}}</p>.

The signal value is changing over time, but the template doesn't show the new value unless I interact with the page.

For example if I close the nav bar or click a button that does nothing, then the template updates with the real signals value.

Any help appreciated. Can show code if necessary.

amber cave
#

Which change detection strategy do you use?
It should work with OnPush but it sounds like something like that

fossil gate
#

I think the issue was not using ngzone, I built an overvable and used ngzone and it worked

#

I don't use change detection with signals

#

Yeah, putting ngzone run around my operations when a message comes in was the fix

exotic crypt
#

To clarify a little - for Angular components today, signals do the equivalent of ChangeDetectorRef.markForCheck(). Change detection will then visit OnPush component that get marked that way when it runs, but that change detection still needs to be triggered via zones.