I am relatively new to JavaScript and AngularJS.

I have been attempting to add an 'ng-click' attribute to a link element with a function as the parameter using the code below:

```
var aTag1 = document.createElement('a');               
aTag1.setAttribute('ng-click', "setID(" + response.data[i].resultID + ")");

```

JavaScript seems to acknowledge that the attribute has been added to the element but the function isn't run when the link is clicked. I'm sure there is a simple answer but I haven't been able to find one for some reason.