renderBody handler in Angular
Hey everyone! ๐
I'm using Novu Inbox in an Angular project and I'm trying to use
renderBody
to allow rendering notification.body
as HTML.
In the React docs, I see this example:
In Angular, I tried:
But renderBody
is never called. Only renderNotification
seems to trigger.
Is renderBody
supported outside of React?
Any recommended approach to customize the body rendering in Angular, ideally allowing raw HTML?
Thanks a lot! ๐7 Replies
Hey, unfortuently this is not documented yet, but you can take a look at how our React package does it:
https://github.com/novuhq/novu/blob/nv-5948-payload-schema-management/packages/react/src/components/Inbox.tsx#L50
we use the props method of mountComponent, and this is the react renderer implementation: https://github.com/novuhq/novu/blob/next/packages/react/src/components/Renderer.tsx
GitHub
novu/packages/react/src/components/Renderer.tsx at next ยท novuhq/novu
The open-source notification Inbox infrastructure. E-mail, SMS, Push and Slack Integrations. - novuhq/novu
GitHub
novu/packages/react/src/components/Inbox.tsx at nv-5948-payload-sch...
The open-source notification Inbox infrastructure. E-mail, SMS, Push and Slack Integrations. - novuhq/novu
@Dima Grossman Hey, quick update:
I confirmed that renderBody is being called in my Angular setup.
However, rendering dynamic content inside el does not work โ Iโve tried:
el.innerHTML = notification.body
Using Renderer2
to create elements and append them
Running it within ngZone.runOutsideAngular
But the <div> stays empty in the DOM.
Is there anything in the Inbox implementation that might prevent manual DOM manipulation in renderBody?
Or is there a specific way you recommend rendering dynamic HTML when using Inbox outside of React?
Thanks again for your help! ๐I will be on the computer a bit later, but here are some opus suggestions based on our indexed codebase:
Version #2
It will probably won't work, but worth a try
hehe
and I'll try to setup some local repo a bit later
version 1 works
thanks!!!
Great ๐
It's been a while since i've used angular, even tho started from angularjs 0.12 or something like this hehe
If you would love to contribute to the docs quickstart page of angular as a section on rendering custom elements (at the bottom of the quick start we can do advanced section or something.
@Dima Grossman Hi, could you help me with this topic? #isOnline always false in Angular project โ how to fix?
@Luiz Carvalho, you just advanced to level 2!