Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown doesn't refresh when input changes, even with change detector #384

Open
Atlinx opened this issue Jun 4, 2022 · 2 comments
Open
Labels
enhancement Improvement request

Comments

@Atlinx
Copy link

Atlinx commented Jun 4, 2022

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.

@Atlinx
Copy link
Author

Atlinx commented Jun 4, 2022

I've worked around this by forcing a rebuild using ngIf

<markdown katex lineNumbers *ngIf="isMarkdownReady">
  {{ project.description }}
</markdown>

@jfcere
Copy link
Owner

jfcere commented Jun 4, 2022

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>

@jfcere jfcere added the enhancement Improvement request label Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement request
Projects
None yet
Development

No branches or pull requests

2 participants