[英]Is it possible to include double curly braces inside an HTML attribute using Vue?
[英]Angularjs: render raw html inside double curly braces - possible?
我想在angular的雙花括號內渲染原始html代碼段,但找不到方法。 我知道有ng-bind-html
指令用於綁定原始html文本,但這僅在標記內有效(我是說它替換了標記的內容),但是我想插入html代碼段而不將其包含在任何標記中。
例:
<div class="row">
<div>....</div>
<div>....</div>
.....
<div>...</div>
{{</div><div class="row">}} <- here's what i'd like to insert - close a row and start a next one
<div>....</div>
<div>....</div>
.....
<div>...</div>
</div>
因此,如果您看一下上面的html結構,我想插入一個結束標記並立即打開一個新標記。 這必須動態完成,因為所有內容都是動態的,我想根據數據模型將其分為幾行。 有任何想法嗎?
我不確定您要做什么,但我很確定這不是最好的方法,甚至不是聰明的方法,但是您可以嘗試以下方法:
{{'</div><div class="row">'}}
在您的范圍內定義一個變量:
$scope.rowHtml = "<strong>Your text here</strong>"
將其分配給<DIV>
ng-model
<div class="row" ng-model="rowHtml ">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.