2016-08-31 1 views
1

Der Code wird wie folgt gerendert: -Zeile hinzugefügt von Direktive über 'Vorlage' wird an den Anfang der Tabelle hinzugefügt?

Vorlage der Direktive ist an der Spitze und dann thead wird gerendert, aber thead wird voraussichtlich an der Spitze sein.

hier ist HTML

<div class="panel_content"> 
    <table summary="A table listing various other formats for this product"> 
     <thead> 
     <tr> 
      <th scope="col">Other Formats</th> 
      <th scope="col" class="site amount"><span>price</span></th> 
      <th scope="col" class="market_place amount"><span>New from</span></th> 
      <th scope="col" class="market_place amount"><span>Used from</span></th> 
      <th scope="col" class="market_place amount"><span></span></th> 
      <th scope="col" class="market_place amount"><span></span></th> 
     </tr> 
     </thead> 
     <tbody> 
      <dir></dir> 
     </tbody> 
    </table> 
    </div> 

dies die Richtlinie

ist
app.directive('dir', function() { 
      return { 
       restrict: 'E', 
       replace: true, 
       template: '<tr><td>asdf</td></tr>' 
      }; 
}); 

Antwort

2

tbody nicht Ihrer Richtlinie dir Tag erwartet (erwartet tr). Versuchen Sie, den Code zu ändern, wie:

app.directive('dir', function() { 
      return { 
       restrict: 'A', 
       replace: true, 
       template: '<tr><td>asdf</td></tr>' 
      }; 
}); 

und verwenden

<tbody> 
    <tr dir></tr> 
</tbody> 
Verwandte Themen