Angular add attribute(directive) before directive compiled

283 views Asked by At

In our project we are developing separate UI Components on angular using custom directives and their attributes like API.

And we faced a problem when element from our component need to be modified with another directive, but this element could be in any tree level.

For instance my component myFineList:

<li>
  <p>Head element</p>
  <ul>
    <li>
      <span>I WANT TO MODIFY THIS ELEMENT</span>
    </li>
  </ul>
</li>

Using it in the project:

 <div>
   <div>Some functionality</div>
   <my-fine-list api-attributes="someValues"></my-fine-list>
 </div>

In project I have drag directive and I want to add it to span element within myFineList component.

  • I cannot change UI Component (in order to understand "why I cannot?", imagine that this is input[type="range"] and I want to add custom directive as attribute to runner to force it to do some stuff for me).
  • And not only add drag attribute, but it needs to be compiled as directive.

In other words: How can I add additional custom directive as attribute to element within another custom directive before it is compiled?

0

There are 0 answers