How to make readonly all inputs in some div in Angular2?

Max K picture Max K · Nov 29, 2016 · Viewed 110.9k times · Source

I have a page with many inputs, and I want to make it 'readOnly' I find this solution: How to change HTML element readonly and required attribute in Angular2 Typescript?

But I don't want to do it for every input separately.

How can I add readOnly property to all inputs in some div.

Answer

Avnesh Shakya picture Avnesh Shakya · Nov 29, 2016

Try this in input field:

[readonly]="true"

Hope, this will work.