基于角度信号的组件。如何在组件装饰器中使用 signal: true 属性?

问题描述 投票:0回答:1

我想尝试基于信号的组件,如下所述: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>`,
})
angular signals reactive-programming angular-signals
1个回答
0
投票

基于信号的组件尚未可用/实现,预计它们将在 17.0 之后登陆。

© www.soinside.com 2019 - 2024. All rights reserved.