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

Using Angular Signals with HostBinding to update style?

Discussão em 'Angular' iniciado por Ole, Setembro 29, 2024.

  1. Ole

    Ole Guest

    In a app-test component I have the following:

    @Input( { transform: booleanAttribute})
    reverse: boolean = false;

    @HostBinding('style.flex-direction')
    direction: string = this.reverse ? 'column-reverse' : 'column';



    And so if the designer applies the reverse attribute to app-test like this:

    <app-test reverse></app-test>


    Then Angular should set style="flex-direction: column-reverse" on the app-test element.

    And I'm wondering how to use Angular signals so that when reverse is set to true, direction will be set to column-reverse. Thoughts?

    Continue reading...

Compartilhe esta Página