我在ng-bind-html中有静态内容,就像这样
<div ng-bind-html="htmlContent">
<div>Static HTML</div>
</div>
但是当我更新控制器内的模型时,内容会被替换。但我希望附加内容。任何人都可以告诉如何实现这一目标。
请参阅以下链接: Fiddle
答案 0 :(得分:0)
试试这个,
内部HTML:已添加按钮
<input name="files" id="files" type="file" />
<script src="~/Scripts/kendo.web.min.js"> </script>
<script type="text/javascript">
$("#files").kendoUpload({
async: {
async: false,
saveUrl: '@saveAPIUrl',
autoUpload: true
},
select: function (e) {
$.each(e.files, function (index, value) {
if (value.extension != ".csv") {
e.preventDefault();
alert("Please upload csv files");
}
});
},
upload: function (e) {
var _token = getToken();
var xhr = e.XMLHttpRequest; // This is return as 'undefined' for xhr
if (xhr) {
xhr.addEventListner("readystatechange", function (e) {
if (xhr.readyState == 1) {
xhr.setRequestHeader("VerificationToken", _token);
}
});
}
e.data = { userId: userId};
},
success: function (e) {
var response = e.response.split(';');
clientSetupViewModel.set("file", response[0]);
clientSetupViewModel.set("clientsetupid", response[1]);
},
error: function (e) {
alert(e.message);
}
});
</script>
内部控制器:创建功能为&#39; updateHtml&#39;
<button ng-click='updateHtml()'>
One Click
</button>
可能会帮助您了解问题