I need yours help. It is possible when a have list of comments as textareas and i would like to disabled single element (comment) by given this element id. Whati have:
<div style="float: right">
<button mat-button color="primary">
<mat-icon class="md-24" (click)="edit()" >edit</mat-icon>
</button>
<textarea [disabled]='enableTextarea' class="comment-textarea" matInput cdkTextareaAutosize rows="2">{{comment.content}}</textarea>
</div>
{{coment.content}} - is content of the comment and it is it what i want to edit (it means enable)
export class CommentComponent implements OnInit {
enableTextarea = true;
edit() {
this.enableTextarea = !this.enableTextarea;
}
}
Here i have two coments with id 1 and 2, and what he wants to achieve to be able to after click edit (pencil on right) disable single comments. In my code all comments are edited, no matter who clicks.
enableTextarea, that is not unique to each element. They want uniqueness. So they can't make them all use that one variable*ngForin all likelihood.*ngForanywhere, which would loop over an array of comments to display, given each of them that boolean value. I can't say it easier than that. @Taplar Probably hit the nail on the head better.