0

I'm working on a small administration of tickets. There's a ticket overview and each ticket has an option to enter the "edit mode". Whenever users triggers the edit mode I want the paragraph tag to become contenteditable. However, the angular triggers an error 'contenteditable' is not a known property of 'p', so I'm wondering if there's some walkaround or am I doing something wrong?

The code representation:

<mat-card>
    <mat-card-content>
        <p [contenteditable]="ticket.isEditMode">
            Some text
        </p>
    </mat-card-content>
    <mat-card-actions>
        <button mat-button (click)="ticket.isEditMode = !ticket.isEditMode">
            Edit
        </button>
    </mat-card-actions>
</mat-card>

1 Answer 1

1

You want to use [attr.contenteditable]. You are accessing the contenteditable attribute on the p tag, not a custom @Input property.

Here is a working Stackblitz example: https://stackblitz.com/edit/angular-lhrdzh.

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

1 Comment

Thanks for the answer. Will mark it as correct in 3mins.

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.