2016-10-16 3 views
0

Ich versuche, eine Ergebnistabelle von einem Mongodb anzuzeigen, aber ich versuche nur, etwas Struktur zu sammeln und gleichzeitig zu lernen, so dass ich gerade einige Dummy-Daten im Moment in einem Controller habeng-repeat in modal view funktioniert nicht

app.controller('modal-controller', function($scope) { 
$scope.fakeResults = [ 
    { 
     "id": "1", 
     "location": "3", 
     "value": "27.5" 
    }, { 
     "id": "2", 
     "location": "3", 
     "value": "27.0" 
    }, { 
     "id": "3", 
     "location": "3", 
     "value": "27.2" 
    }, { 
     "id": "4", 
     "location": "3", 
     "value": "27.9" 
    }, { 
     "id": "5", 
     "location": "3", 
     "value": "28.5" 
    } 
]; 
}); 

der hTML-Code für den Modal Abschnitt im unter

<div ng-controller="modal-controller" class="portfolio-modal modal fade" id="portfolioModal1" tabindex="-1" role="dialog" aria-hidden="true"> 
    <div class="modal-content"> 
     <div class="close-modal" data-dismiss="modal"> 
      <div class="lr"> 
       <div class="rl"> 
       </div> 
      </div> 
     </div> 
     <div class="container"> 
      <div class="row"> 
       <div class="col-lg-8 col-lg-offset-2"> 
        <div class="modal-body"> 
         <h2>Temperature Table</h2> 
         <hr class="star-primary"> 
         <p>TEST TEXT {{ fakeResults }}</p> 
         <tbody> 
          <tr ng-repeat="result in fakeResults"> 
           <td>{{$index + 1}}</td> 
           <td>{{result.id}}</td> 
           <td>{{result.location}}</td> 
           <td>{{result.value}}</td> 
          </tr> 
         </tbody> 
         <img src="img/portfolio/cabin.png" class="img-responsive img-centered" alt=""> 
         <p>This page will be used to display simple table of temperature results</p> 
         <ul class="list-inline item-details"> 
          <li>Hardware: 
           <strong>Tinkerforge equipment linked</strong> 
          </li> 
          <li>Software: 
           <strong>Github Link</strong> 
          </li> 
          <li>Difficulty: 
           <strong>1</strong> 
          </li> 
         </ul> 
         <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-times"></i> Close</button> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
</div> 

die Ergebnisse sind sichtbar, nachdem die gesamte Stichprobe von Daten sehen, aber nicht mit ng-repeat versuchen, um die Ergebnisse anzuzeigen. Ich bin mir nicht sicher, warum das so ist, aber ich habe es hoffentlich auf etwas beschränkt, das die ng-Wiederholung betrifft.

Danke

Antwort

0

Sie table-Tag rund um Ihr tbody

vergessen
    <table> 
         <tbody> 
          <tr ng-repeat="result in fakeResults"> 
           <td>{{$index + 1}}</td> 
           <td>{{result.id}}</td> 
           <td>{{result.location}}</td> 
           <td>{{result.value}}</td> 
          </tr> 
         </tbody> 
        </table>