I have created an Angular 21 app by using the CLI. Zone.js was generally uninstalled beforehand.
I made a simple test app with two counter buttons.
One button updates a signal, and the other updates a plain number. Both button works fine.
As I understand, zoneless Angular requires signals for correct updating but not plain number variables.
Here is my template:
template: '' +
'Y: {{Y}}\n' +
'<button (click)="updateY()">Y++</button>\n' +
'<br>\n' +
'X: {{X()}}\n' +
'<button (click)="updateX()">X++</button>',
And the component code:
public Y=0
public X=signal(0)
updateY(){
this.Y++
}
updateX(){
this.X.update(()=> this.X()+1)
}
Is the use of a plain variable correct anymore?
Complete code is available on StackBlitz: https://stackblitz.com/edit/stackblitz-starters-hsznsgww?file=package.json