Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

222
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda