繁体   English   中英

如何将 ngx-quill 编辑器内容从我的数据库渲染到视图组件?

[英]How can i render ngx-quill editor content from my database to a view component?

我正在开发一个使用 ngx-quill 作为文本编辑器的 angular 博客应用程序。 将记录添加到我的数据库中没有任何问题。 当我尝试呈现内容时出现问题,它没有显示数据。

这是我要在其中显示内容的详细信息发布组件 HTML:

 <article class="post" *ngIf="post$ | async as post; else loading"> <div class="post-thumbnail" style="background-image: url(&quot;https://images.unsplash.com/photo-1538370965046-79c0d6907d47?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80&quot;);" > <h1 class="post-title">{{ post.titlePost }}</h1> <div class="post-meta">February 20, 2020</div> </div> <div class="blog-post-content"> {{ post.contentPost }} </div> </article> <ng-template #loading> <div class="container-spinner"> <mat-spinner></mat-spinner> </div> </ng-template>

对于ngx-quill,您必须使用它们自己的指令

<quill-view [content]="content" format="text" theme="snow"></quill-view>

innerHTML 更多信息在这里

<div class="ql-container ql-snow" style="border-width: 0;">
  <div class="ql-editor" [innerHTML]="byPassedHTMLString">
  </div>
</div>

我建议使用他们自己的指令。

干杯

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM