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

340
Views
Can I use a same form to add and edit form data in angular?

I have a form to add the data to the database. I have to create an update feature now, so I need to know if I can use the same form that I have created to add data to database or make another form for the update feature. What is the best practice? Should I have to implement update feature as a separate component or that's not necessary?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

As long as they are really similar (e.g. they won't have some extra validation rules which will enforce you to write many if inside the component) it is good practice to reuse components wherever it is possible.

If you have different endpoints for creating/updating resource you can easily pass custom onSubmit function to your form component which will call proper service method.

<your-form (onSubmit)="add(...)">
</your-form>

<your-form (onSubmit)="update(...)">
</your-form>
over 4 years ago · Santiago Trujillo 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!