2

I have a list of contacts built in Angular, and I need to create an "Add Activity" function.

To do this I want to be able to insert an external HTML template with its own controller into an existing template dynamically.

The current HTML is as follows:

<table style="width:100%">
  <tr ng-repeat="Contact in Contacts | orderBy: 'LastName'">
    <td> {{ Contact.FirstName }} {{ Contact.LastName }} </td>
    <td>Add Activity</td>
  </tr>
</table>

I want to click Add Activity and have Angular insert HTML from an external template into a new row beneath the clicked row.

Is this possible?

Andy W
  • 21
  • 1
  • Take a look here: [AngularJS How to dynamically add HTML and bind to controller](http://stackoverflow.com/a/19846600/2920197) – Pedro Perez May 02 '17 at 10:09
  • Thanks a lot, I've created something similar to what I need, but I am struggling to insert an HTML row on the row beneath a clicked button. I want to be able to add a row for one row only, not every row? Please see the plunkr: http://plnkr.co/edit/D8CMPfR4Bs19y0WpZ6S9?p=preview – Andy W May 04 '17 at 14:41

0 Answers0