Home » AngularJS ng-href Directive

AngularJS ng-href Directive

by Online Tutorials Library

AngularJS ng-href Directive

The AngularJS ng-href directive provides a replacement for the original href attribute of an &lta> element. You can use the ng-href directive instead of href if you have AngularJS code inside the href value.

The ng-href directive ensures that the link is not broken even if the user clicks the link beforethe code execution. It is supported by &lta> element.

Syntax:

Parameter explanation:

string: It specifies a string value, or an expression resulting in a string.

Let’s take an example to demonstrate the ng-href directive.

See this example:

Test it Now

You may also like