Home>

angularjs ng-href directive

angularjs example

Add link using angularjs settings:

<! Doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="">
<div ng-init="myvar =" http://www.runoob.com "">
<h1>Noob Tutorial</h1>
<p>access<a ng-href="{{myvar}}">{{myvar}}</a>learn!</p>
</div>
<p>This instance can use the native href attribute, but in angularjs, the ng-href attribute is more secure.
</p>
</body>
</html>

Definition and usage

The ng-href directive overrides the native

Theelement supports the directive.

Parameter value

value description
expression String, expression execution result

  • Previous jQuery simple implementation of colored cloud tag effect example
  • Next 8 must-have PHP features for development