Can anyone help me with this issue?
I have successfully managed to dynamically append an element, but it is not getting compiled. I have looked at several tutorials like this one
However, these tutorials do not exactly meet my requirements. They often use hashtag notation to identify the container.
What I need is to append a component to any element that might have my custom directive on it.
In addition, I would like to utilize the bound value of the directive to control a hidden attribute on the appended element.
My Objectives:
- Customize existing component behavior:
- Add an attribute for show/hide functionality
- Add a class for styling customization
- Simplify HTML coding
- Eliminate the need to write the entire component
<my-comp></mycomp>
- Avoid specifying the class explicitly
- Automatic functionality if the class name changes
- Modify the element where the directive is applied
- Ultimately, add a class to the container element
- Eliminate the need to write the entire component
Expected Input Source:
<div [myDirective]="myBoolean">
<p>some content</p>
</div>
Expected Output After Compilation:
<div [myDirective]="myBoolean" class="myDirectiveClass1">
<p>some content</p>
<someComponent [hidden]="myBoolean" class="myDirectiveClass2"></someComponent>
</div>
Is there a solution to achieve this? Any help would be greatly appreciated.