Can I change dynamically innerHTML input code?

1059 views html

I have a small angular app. One component use innerHTML to display content

<div [innerHTML]="serviceShared.currentMood"></div> 

But when I change value of serviceShared.currentMood in main component nothing changes. Can I change content dynamically and re-render the component?

Thanks for the help.

answered question

Can you please supply more details around the serviceShared.currentMood property and how you are changing it?

If you're loading asynchronously, you'll need $scope.$apply() after var is updated.

1 Answer


Maybe in the decorator of your component ChangeDetectionStrategy is set to onPush

posted this

Have an answer?


Please login first before posting an answer.