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

158
Visualizações
How to select from list of items rendered using ng-repeat

I am having arrays of array as response

[
   [
     "i-091a5dosdobs2",
     "t2.nano",
     "running"
   ],
   [
     "i-03dd8duhud9",
     "t2.micro",
     "running"
   ]
]

I am using ng-repeat and rendering the data into table

<tbody>
  <tr ng-repeat="datas in data" >
   <td ng-repeat="d in datas">
    {{d}}
   </td>
   <td>
    <button class="btn btn-primary" ng-click="close(d)">Close</button>
   </td>
  </tr>
  </tbody>

I want button in all the rows which can able to close that particular instance but how to do it ? in json we can do with key. How can I do it here ?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

If you need a unique key to close the row by it. Then you can use

<tr ng-repeat="(key, value) in data">

so the key will point to the index of the array 0, 1, 2, ...

about 4 years ago · Juan Pablo Isaza Relatório

0

You only need to pass the ec2 instance ID which is d[0]

<button class="btn btn-primary" ng-click="close(d[0])">Close</button>

and your close function would be like

$scope.close = function(id) {
   // factory send ajax to close the instance ... then
   let index = $scope.data.findIndex((i)=> i[0]===id)
   $scope.data.splice(index,1); // this would remove the item from your table
}
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