Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Angular | Add dynamic html property to childcomponent

I want to add a dynamic html property to my childcomponent in the html, like hits:

<child-component test={{ variable }}></child.component>

I dont want to use it as an input just need it in the html for testing.
I tried the above but when i do this I get an error:

"Can't bind to 'test' since it isn't a known property"

Is there a good solution for this?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thx!

>Solution :

You can make use of attr to just create a attribute!

<child-component [attr.test]="variable"></child.component>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading