I have a form with a single text box that allows 35 characters. I want the user to be able to click a button to add another identical textbox to the form below which also allows 35 characters. The add button would only allow 3 more text boxes to be added. Is there an easy way to do this? Here is the code of what I have so far. My first idea was to just have the same code replicated 4 times and hide it until the button was clicked but was wondering if this could be done in an array or some kind of function to avoid so much duplication. Thanks!
HTML
<div>
<h2>Title</h2>
<div>
<mat-form-field appearance=outline>
<mat-label>Title</mat-label>
<input matInput formControlName="Title" maxlength="35" required>
</mat-form-field>
</div>
<button>Add Line</button>
</div>