How to preventdefault on anchor tags?



How to preventdefault on anchor tags?..

Answer / Dhananjay Singh

To prevent the default action of an anchor tag in AngularJS, you can use the ng-click directive along with $event to call a function and stop the default action. For example: <a ng-click="myFunction($event); $event.preventDefault()">Link Text</a>

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

How can we share the data between controllers in angularjs?

1 Answers  


What is angularjs latest version?

1 Answers  


Is angularjs extensible?

1 Answers  


How to set headers for every request in angular?

1 Answers  


How to create custom directives?

1 Answers  


What is the difference between $watch, $digest and $apply?

1 Answers  


What is flex in angular material?

1 Answers  


What is Component in Angular Terminology?

1 Answers  


What are zones? What is change detection?

1 Answers  


How to declare a component in angular 2?

1 Answers  


What is the advantage of angular?

1 Answers  


Can't bind to ngmodel since it isn't a known property of input?

1 Answers  


Categories