angularjs ng-href directive

angularjs example

Add link using angularjs settings:

<! Doctype html>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
<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>
<p>This instance can use the native href attribute, but in angularjs, the ng-href attribute is more secure.

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