将trix编辑器与angular和laravel结合使用

时间:2020-06-11 06:45:00

标签: angular laravel mongodb

我正在建立一个网站,该网站使用laravel作为后端,使用mongoDB作为数据库使用angular作为前端。我有一个内容字段,我想用html标记存储文本,为此,我尝试使用trix-editor。我遇到的问题是Trix将内容存储在名为post-trixFields的字段中,而这在角度上并不受欢迎,它会出现错误:

`

ERROR in src/app/blog/blog-detail/blog-detail.component.html:19:13 - error TS2339: Property 'post' does not exist on type 'Blog'.

19 <div>{{blog.post-trixFields}}</div>
               ~~~~

  src/app/blog/blog-detail/blog-detail.component.ts:20:16
    20   templateUrl: './blog-detail.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component BlogDetailComponent.
src/app/blog/blog-detail/blog-detail.component.html:19:18 - error TS2339: Property 'trixFields' does not exist on type 'BlogDetailComponent'.

19 <div>{{blog.post-trixFields}}</div>
                    ~~~~~~~~~~

  src/app/blog/blog-detail/blog-detail.component.ts:20:16
    20   templateUrl: './blog-detail.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component BlogDetailComponent `

Aka angular将“ post-trixFields”解释为2个单独的项目,而不是1个字段。有没有一种方法可以使角度整体接受,或者有人知道重新配置Trix的方法,以便它使用“ post-trixFields”这样的方法吗?

还是Trix编辑器根本不起作用?在这种情况下?

谢谢,汉斯

PS如果我将Trix拿出来,只需在标准内容字段中输入<b>text</b>,我就可以用角度解释HTML ..我已经弄清楚了

PPS:日期是通过和HTTP GET到达的,因此我的服务具有可观察的等

0 个答案:

没有答案