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

212
Views
How can I get form data and add it to an object in Angular?

I am using this form to take some basic information:

 <form action="/action_page.php" method="GET" name="clientForm">
        <label for="cname">Client name:</label><br>
        <input type="text" id="cname" placeholder="client name:" name="cname" required><br>
        <label for="clienturl">URL:</label><br>
        <input type="text" id="clienturl" placeholder="url:" name="clienturl" required><br><br>
        <input type="submit" value="Submit" button (click)="addClient()" >
        <input type="reset" value="Reset">
      </form>

This is the data i am currently holding:

  export const clients = [
    {
      name: 'client1',
      url: "https://www.google.com"
    },
    {
      name: 'client2',
      url: "https://www.yahoo.com"
    },
    {
      name: 'ACB',
      url: "https://www.dailymail.co.uk"
    },
    {
      name: 'client3',
      url: "https://www.youtube.com"
    },
    {

      name: 'client4',
      url: "https://www.nhs.uk"
    },
  ];

Then in my component I am struggling to get the data entered into the form and add it as an object to the existing data.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you use the Reactive Forms / Angular Standard Forms in your angular app, you can get it...

<form [formGroup]="FormName" (ngSubmit)="submit()">

in TypeScript:

this.FormName.value

For more details, see the official documents

By using the traditional way, you can add in to the object

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!