javascript - 如何使用 Angular 和 js 附加多个羽毛笔编辑器
问题描述
我想将多个羽毛笔编辑器附加到一个带有附加的 div 中。
目标是在帖子类型为 1 或 2 时附加合适的模板,并在羽毛笔编辑器中附加这些帖子的内容
但我不知道如何生成多个鹅毛笔编辑器,我试过这个:
$http.post("/getwallpost", reqGetPost).then(function(response) {
response.data.forEach(function(item) {
if(item.type_id == 1) {
var youp = "#" + item.id
wallcontent.append("<div id='" + item.id + "'></div>");
new Quill("#" + item.id, optionwall).setContents(JSON.parse(item.content));
} else if(item.type_id == 2) {
wallcontent.append('<div class="myArticles">This is article</div>');
}
});
});
<div id="wallcontent">
</div>
解决方案
没关系,它有效。
我使用数字作为 html id。我不得不使用像“#sqjdofjez”+ item.id 这样的字符,而不仅仅是“#5”
推荐阅读
- javascript - 在Angular中倒退时间的最佳方法是什么
- java - 使用 RestTemplate 调用 API 时如何捕获超时异常
- javascript - 如何避免标题标签中的换行符?
- python - 通过 SqlAlchemy 中的 M2M 关系“跳转”的关系(用户 -> 角色 -> 权限)
- android - ffmpeg解码,通过shader得到avFrame(yuv420p),yuv转rgb,但是太绿了
- git - git interactive rebase squash 创建了全新的分支
- c - 如何将int类型转换为ieee754?
- python - 如何使用 Opencv 检测另一个轮廓中的一个轮廓?
- node.js - 访问 Firebase 存储中的文件会导致 403(“要计费的项目与缺少的计费帐户相关联”)
- c - 允许使用“scanf”输入空格