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

Angular variable value change not reflecting in @if condition

Discussão em 'Angular' iniciado por Prateek Tewary, Setembro 13, 2024.

  1. I am changing the value of my isEditing variable to show that the edit button has been clicked. This should show input field in a table row. I am using angular material table but I don't think this matters.

    Changing the value of the variable during start in the .ts shows the required change but again clicking the button the input doesn't toggle (Edit/Cancel functionality)

    @if (innerColumn == " Amount" =&& isEditing) {
    //some code here
    } @else {
    <td mat-cell *matCellDef="let innerElement">
    {{ innerColumn + "-" + isEditing }}
    </td>
    }


    The else condition is always triggered and it shows the isEditing variable takes values both true and false but this doesn't show up in @if.

    I tried using debugger and displaying in the screen. The value is shown in the screen but the if condition is not triggered.

    Continue reading...

Compartilhe esta Página