I want to insert a new HTML tag with an event attached to it. Here is an example of what I am trying to achieve:
<html ng-app="module">
<head>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script>
</head>
<body ng-controller="clickTest">
<div>
<input type="button" value="button1" ng-click="click($event)">
</div>
</body>
<script>
var module = angular.module("module", []);
module.controller("clickTest", function($scope, $http){
$scope.click = function($event) {
$($event.currentTarget.parentNode).append('<input type="button" value="button2" ng-click="click($event)">');
}
});
</script>
</html>
Can anyone provide guidance on how to add an event in AngularJS?