Vorrei sapere come posso creare un elemento DIV dinamicamente in Angular JS.
<table ng-controller="tableController"> <tr ng-repeat="totaldivs en parametros"> <td ng-repeat="divId en totaldivs"> <!-- quiero poner algo como esto <div id="dias_01"><span>DIV_01</span></div> --> </td> </tr> </table>
In jQuery posso farlo usando $('#IdOr.Class').html(param);
ma come faccio a farlo in AngularJS?
1 Risposte
Si può fare qualcosa anche:
<table ng-controller="tableController">
<tr ng-repeat="totaldivs en parametros">
<td ng-repeat="divId en totaldivs">
<div id="{{divId}}"><span>{{divContent}}</span></div>
</td>
</tr>
</table>
Sei già dentro il loop, quindi il div verrà creato per ogni Td. Hai solo bisogno di collegare i valori al div.
Per favore, login o Registro per fare una domanda