Answer the question
In order to leave comments, you need to log in
How to insert template directive AFTER element without replacing it in AngularJS?
Good day! The task is to create a pop-up dropdown below the input field, I put my-directive on the input, but here's what to write in the code for the directive so that the element is not replaced (replace: false inserts the directive template into the input, which is also meaningless). I also don't want to place the directive below the text field, then the link between the directive and the field will be lost. The option to move the input inside the template and make a replacement is also not the best, because if the user wants to set some styles, attributes, then they must be in the template that will replace the original input. What are the options for solving this problem?
Answer the question
In order to leave comments, you need to log in
Not the most elegant solution, but at the pre-link stage of the directive, you can manually append after input and compile.
Here's an example: codepen.io/AMar4enko/pen/QbxqVY
Actually, the dropdown should be inserted at the end of the <body> and be fixed, with an offset top/left.
Make two directives - one will add dropdown, the second implements the widget itself. Connect them with this .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question