computed function is called, but no logging to console

Discussão em 'Angular' iniciado por derstauner, Fevereiro 22, 2025.

  1. derstauner

    derstauner Guest

    I'm experimenting with signals and following this blog post. I'm at the section 'Overriding the signal equality check'.

    I have this two simple signals according to the blog post:

    object = signal({
    id: 1,
    title: 'Angular For Beginners',
    });
    title = computed(() => {
    console.log(`Calling computed() function...`);
    const course = this.object();
    return course.title;
    });


    And the click function:

    updateObject() {
    // We are setting the signal with the exact same
    // object to see if the derived title signal will
    // be recalculated or not
    this.object.set({
    id: 1,
    title: 'Angular For Beginners',
    });
    }


    The updateObject event is binded in the html template to the click button event correctly.

    My question is, why I don't get any console.log messages? Even if I change in the updateObject method the title value, I see in the template, that the title was changed, but no console.log. Why?

    Continue reading...

Compartilhe esta Página