i’m changing a innter html of a dom element with a button. And when button is clicked i want to fire another controller function. Something like that. … But is not working :).
$scope.addBtn = function() {
$('domtarget').html('<button ng-click="removeButton();"></button>');
}
$scope.removeBtn = function() {
$('domtarget').html('');
}
Please suggest fix 🙂
Do not modify DOM inside your controller, ever.
.
For hiding/showing an element conditionally, use ng-show or ng-hide.
For firing an event on click, use ng-click