I want to have a form, which has an input field taking numbers (15,30,45), which will be used as minutes. It is supposed to have an add button, which will add another row of that input with that add button beside it aswell. If I have more than one of those fieldsets, then I want to have a button besides all fieldsets, that can delete the input.
<div id="minute">
<label for="MinuteImput">In Minute </label>
<input type="number" id="MinuteImput" min="0" max="45" step="15">
<button>+</button>
<button *ngIf="count divs with id minute > 1" >-</button>
</div>
In Angular framework try to avoid using "id" itself. The theme of this framework is data binding. For your case you need to use "ngFor". Something like following.
<div *ngFor='let num of inptFieldArray'>
<label for="MinuteImput">In Minute </label>
<input type="number" id="MinuteImput" min="0" max="45" step="15">
<button (click)="inptFieldArray.push(inptFieldArray.length)">+</button>
<button *ngIf="inptFieldArray.length> 1" (click)="remove(num)">-</button>
</div>