Signals is a cutting edge feature in Angular.
But the questions arouse what is the difference between
computed(() => `Result: ${this.someSignal()}`)
和
get someGetter () { return `Result: ${this.someSignal()}` }
首先我想,当 Select ChangeDetectionStrategy.OnPush
时,getter可能不会运行,但事实并非如此.
下面是一个例子,两者的工作原理相同, https://stackblitz.com/edit/github-s2epxq?file=src%2Fmain.ts
So what is the difference 和 should we really prefer one before another?