Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
Angular dynamically add a fieldset with and input and button

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>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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>

Reference

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!