Код: Выделить всё
import { Component, signal } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
@Component({
selector: 'app-root',
template: `
{{id()}}
{{num()}}
`,
})
export class App {
id = signal(1);
num = signal(1000);
ngOnInit() {
setInterval(() => {
this.id.update((prev: number) => prev++);
this.num.update((prev: number) => prev--);
}, 2000);
}
}
bootstrapApplication(App);
Подробнее здесь: https://stackoverflow.com/questions/794 ... -operation
Мобильная версия