Egor2014-11-24 13:51:52
Egor, 2014-11-24 13:51:52

Angular. How to load HTML template on a specific event?

Good afternoon.
It is necessary to load html code from a file on some event. Let's say a button is clicked.
I found ng-include and src, but if I understood everything correctly, then the template will be loaded immediately upon initialization. How to load only on event?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_ _, 2014-11-24

<div ng-if="showTemplate">
    <div ng-include="path/to/your/template.html"></div>    
<button ng-click="showTemplate = true;">Show template<button>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question