Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

221
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda