<div ng-repeat="(keyC, column) in columns.form" ng-model="columns.form" >
<div class="well">
<p><strong>BLOCK {{ keyC }}</strong></p>
<div ng-repeat="(keyP, p) in column.perguntas" ng-model="column.perguntas" >
<formulario data="p" ></formulario>
</div>
</div>
</div>
如何使用ng-repeat打印html元素和textarea
?
最后,html代码应该打印在textarea
内,如下所示:
<div class="well">
<p><strong>BLOCK 0</strong></p>
<div class="alert alert-danger">88888</div>
</div>
<div class="well">
<p><strong>BLOCK 1</strong></p>
<div class="alert alert-danger">123123123</div>
</div>
Jsfiddle更好地了解我的问题: https://jsfiddle.net/na4t6k57/
我试图做这样的事情,但它不起作用。
<div ng-init="html = ''"></div>
<div ng-repeat="(keyC, column) in columns.form" ng-model="columns.form" >
{{ html += '<div class="well">' }}
{{ html += '<p><strong>BLOCK' + keyC + '</strong></p>' }}
<div ng-repeat="(keyP, p) in column.perguntas" ng-model="column.perguntas" >
{{ html += '<formulario data="p" ></formulario>' }}
</div>
{{ html += '</div>' }}
</div>
<textarea ng-model="html"></textarea>
我想要的最终结果: http://i.imgur.com/LkRJLOv.png