Ilja
Ilja

Reputation: 46479

pass clicked elements href as a parameter in ng-click

I can't figure out a way how to do something like this:

<a href="http://google.com" ng-click="myFunc(this.href)">Link</a>

So essentially I want to pass href of clicked link as a parameter for myFunc

Upvotes: 0

Views: 575

Answers (1)

Oleksandr T.
Oleksandr T.

Reputation: 77482

Try this

<a href="http://google.com/" ng-click="myFunc($event.target.href)">Link</a>

Example

Upvotes: 5

Related Questions