angular - update directive template on click
问题 I am trying to build a page using Angular. I have two templates, say <script type='text/ng-template' id='a.html'> /*some html using {{data}} */ <div><button>A</button></div> </script> and <script type='text/ng-template' id='b.html'> /*some html using {{data}} */ <div><button>B</button></div> </script> I would like to create a directive that changes its template from a to b and vice versa when the button inside the template gets clicked. I tried several options, looking at other answers to