Inject custom attribute

In Au1, it was possible to inject a custom attribute (of a parent scope) in a custom element, in Au2 this is not possible anymore:

Is this by design? Thanks for any help.

In v1, all including custom attributes participate in “component container hierarchy”, which is considered improper design and this has been removed in v2. In v2, only custom elements/specific template controllers participate in “component container hierarchy”. Maybe imagine custom attribute as leaf nodes of a tree. So to your question, it’s not possible to just inject. But you can always inject a hydration context and do the provide inject pair with the container there.

Example custom attribute injection (forked) - StackBlitz

I’ve also tweak the .register calls in main.ts so you don’t have to repeat .register many times.


This is great, thanks for your help!