Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Criar diretiva de <table>

Gostaria de criar uma diretiva como a descrita abaixo, meu código não funciona é somente ilustrativo. Gostaria de ajuda pra entender como fazer isso. Desde já agradeço a ajuda.


VIEW
    <body ng-controller="PrincipalController">
        <main class="container">
            <minha-table colunas="Título,Foto" >
                  <tr ng-repeat="foto in fotos">    
                    <td>{{foto.titulo}}</td>
                    <td><img src="{{foto.url}}"></td>          
                  </tr> 
      </minha-table>
        </main>     
    </body>

DIRETIVA

angular.module("diretivas",[]) .directive('minhaTable', function(){

var ddo= {};

ddo.restric = "E";

ddo.scope = { colunas: '@'.split(',')

};

ddo.transclude = true;

ddo.templateUrl = 'js/directives/minha-table.html'

return ddo; });

TEMPLATE



<table class="table table-striped table-bordered table-hover table-sm">
  <thead class="thead-dark">
    <tr>
      <th ng-repeat="coluna in {{colunas}}">{{coluna}}</th>
    </tr>
  </thead>
  <tbody>

  </tbody>
</table>
1 resposta
solução!

Fala ai Vinicius, de boa ?

Cara conseguiu resolver isso ?

Vi que tá uma semana parado.