ngx-markdown
ngx-markdown copied to clipboard
Markdown doesn't refresh when input changes, even with change detector
I have a bit of html that is supposed to render data fetched from a backend in markdown:
<markdown katex lineNumbers>
{{ project.description }}
</markdown>
I run a change detector after fetching the data in order to update all the view
this.changeDetector.detectChanges();
However, the markdown component renders nothing, because it's only taking the initial value of project.description, which is empty.
I've worked around this by forcing a rebuild using ngIf
<markdown katex lineNumbers *ngIf="isMarkdownReady">
{{ project.description }}
</markdown>
Hi @Atlinx,
Thanks for reporting the issue. As a workaround, you can use the data
input property which will render the markdown correctly when the value is updated.
<markdown
katex
lineNumbers
[data]="project.description">
</markdown>