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

67
Visualizações
ng-repeat nested array of object in same row

I am trying to bind the data in the same row in a nested array.

My Array of Objects

$scope.Record = [
{ Name:'Adam', 

Months:[
 {Month: 'Jan', Value: 10, cust:2},
 {Month: 'Feb', Value: 30, cust:2}
 {Month: 'March', Value: 30, cust:2}
 {Month: 'April', Value: 50 , cust:2}
 {Month: 'June', Value: 15 , cust:2}
 ] },

  { Name:'John', 
Months:[
 {Month: 'Jan', Value: 10 , cust:3},
 {Month: 'Feb', Value: 30,, cust:6}
 {Month: 'March', Value: 30,, cust:8}
 {Month: 'April', Value: 50,, cust:13}
 {Month: 'June', Value: 15,, cust:20}
 ] }
]

my View

     <tr>
         <th colspan="1">Customer</th>
         <th colspan="2">January</th>
         <th colspan="2">February</th>
         <th colspan="2">March</th>
          <th colspan="2">April</th>
          <th colspan="2">May</th>
          <th colspan="2">June</th>
    </tr>
     <tr>
       <th>Name</th>
       <th>Value</th>
       <th>Cust</th>
     </tr>
    <tbody>
    <tr ng-repeat="rc in Record">
      <td ng-bind="rc.Name"></td>
      <td ng-bind="rc.Months[0].Value"></td>
      <td ng-bind="rc.Months[0].cust"></td>
     </tr>
    </tbody>

How to bind all the Months array of Object in the same row. I am trying all the things but not getting any luck.

Thank you

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

0

I updated your code and provided a working example here: https://jsfiddle.net/galeroy/z97u230v/25/

Here's the trick to implementing nested repeats in AngularJS

<tbody ng-repeat="rc in records">
    <tr>
        <td>{{rc.name}}</td>
        <td colspan="2" ng-repeat="item in rc.months">
            <span ng-if="item.value">val: </span> {{item.value}}
            <span ng-if="item.value && item.cust">, </span>
            <span ng-if="item.cust">cust:</span> {{item.cust}}        
         </td>
      </tr>
 </tbody>
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