Answer the question
In order to leave comments, you need to log in
Is it correct to replace ng-click with your own directive in angularjs?
For example, deleting a comment should be like this:
<button ng-click="vm.deleteComment(comment.id)">Delete</button>
<button data-delete-post >Delete</button>
Answer the question
In order to leave comments, you need to log in
If the method
will only be used in one controller, then ng-click can be used, and if the method will be used in multiple controllers, it's better to make a directive so as not to duplicate the method in each $scope.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question