EspañolDeutschFrançaisItalianoPortuguêsРусскийΕλληνικά日本語中文(简体)हिन्दी; हिंदीالعربية
Сделать основным языком
PF вопросы - Форум

Создать элемент DIV в AngularJS??

Я хотел бы знать, как можно динамически создать элемент DIV в угловых 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>

В jQuery я могу сделать это с помощью $('#IdOr.Class').html(param); Но как я могу это сделать в AngularJS?

Share on Facebook Tweet about this on Twitter Share on Google+ Pin on Pinterest Share on Reddit Share on VK Share on StumbleUpon Share on Tumblr Share on LinkedIn Email this to someone Print this page
portirca спросил ли 7 лет
1 Ответы

Вы можете сделать что-то вроде:

<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>

Вы внутри цикла, так Div будет создаваться для каждого ТД. Только нужно привязать значения дивы.

Share on Facebook Tweet about this on Twitter Share on Google+ Pin on Pinterest Share on Reddit Share on VK Share on StumbleUpon Share on Tumblr Share on LinkedIn Email this to someone Print this page
arnelo Саид делает 7 лет