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

208
Vistas
Angular 12:set and get value from a textbox in a record inside grid

As title.
Let me use an example to explain what I want. Assume that I am a teacher and have a set of student exam scores like this:

[
{"name":"John","score":88},
{"name":"Andy","score":80},
{"name":"Mary","score":93},
{"name":"Sandra","score":76},
{"name":"Thomas","score":55},
{"name":"Peter","score":69}
]

I want to display it inside a grid with score field is shown in an input area that I can edit to change student's score. And I need to get the changed score of a student. I can make my page as this:

<table class="table">
                    <thead>
                        <tr>
                          <th scope="col">Name</th>
                          <th scope="col">Score</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr *ngFor="let stu of students">
                            <td>{{stu.name}}</td>
                            <td>{{stu.score}}</td>
                        </tr>
                    </tbody>
                </table>

Then I didn't know how to make the score can be edited and how to get the edited value from a certain record. Could someone guide me a way to get it? I've searched use key word "angular set and get input inside grid" but find some didn't match what I needed and some uses older Angular.js and may not suitable for my request.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can achieve it like this ngModel will automatically update students;

<table class="table">
                    <thead>
                        <tr>
                          <th scope="col">Name</th>
                          <th scope="col">Score</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr *ngFor="let stu of students">
                            <td><input [(ngModel)]="stu.name"></input></td>
                            <td><input [(ngModel)]="stu.score"></input>}</td>
                        </tr>
                    </tbody>
                </table>
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