0

I have a list displaying all the columns in the grid in the following template manner

<ul id="gridColumnList" class="gridColumnList">
    <li *ngFor="let col of grid.colModel">
        <span><input type="checkbox" class="checkbox col-visibility" **[checked]="!col.hidden"** /></span>
        <span><input type="checkbox" class="checkbox col-freeze" [checked]="col.locked" **[disabled]="col.hidden"** /></span>
        <span class="col-title">{{col.label}}</span>
    </li>
</ul>

I want to change the state of the checkbox input based on the col.hidden value which is a boolean type but the property binding does not work instead if interpolation is used like checkbox = {{col.hidden}} it works. what is wrong with the property binding?

1 Answer 1

1

remove all "**"

<span><input type="checkbox" class="checkbox col-visibility" [checked]="!col.hidden"/></span>

add a testing plunker

Sign up to request clarification or add additional context in comments.

2 Comments

While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations!
** is not there. its written in the same manner as you wrote. ** was to distinguish as bold

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.