1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How do Angular's computed() signals work? [closed]

Discussão em 'Angular' iniciado por Leogout, Setembro 30, 2024.

  1. Leogout

    Leogout Guest

    I don't understand how computed() works. How does Angular knows when to update it ? I don't see anything that can trigger its update in the following code, but it actually gets updated each time a new value is sent in chartData.

    import { Component, computed, input } from '@angular/core';
    import { ComponentChartData } from '../../../../models/component';

    @Component({
    selector: 'app-chart',
    standalone: true,
    templateUrl: './chart.component.html',
    styleUrl: './chart.component.scss',
    })
    export class ChartComponent {
    chartData = input.required<ComponentChartData>();
    datasets = computed(() => this.chartData().datasets);
    }

    Continue reading...

Compartilhe esta Página