我想尝试基于信号的组件,如下所述:https://github.com/angular/angular/discussions/49682
尝试在组件装饰器中使用
signals: true
时出现错误。该错误表明它不是已知属性。我正在使用最新版本的 Angular 16.2.0。我需要在 angular.json 中更改某些内容或类似的内容才能启用此功能吗?
这是我的组件装饰器:
@Component({
signals: true,
standalone: true,
selector: 'app-counter',
imports:[CommonModule],
template: ` <!-- count is invoked as a getter! -->
<p>Count {{ count() }}</p>
<p>{{ name }}</p>
<!-- Not reactive! -->
<button (click)="increment()">Increment count</button>`,
})
基于信号的组件尚未可用/实现,预计它们将在 17.0 之后登陆。