0

我正在开发一个使用 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>

4

1 回答 1

0

对于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>

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

干杯

于 2020-10-20T01:57:15.030 回答