AngularJS ng-href 指令

AngularJS 教程 · 2019-04-01 17:38:56

AngularJS 实例

使用 AngularJS 设置添加链接:

<div ng-init="myVar = 'http://www.codercto.com'">
    <h1>码农教程</h1>
    <p>访问 <a ng-href="{{myVar}}">{{myVar}}</a> 学习!</p>
</div>

定义和用法

ng-href 指令覆盖了原生的 <a> 元素 href 属性。

如果在 href 的值中有 AngularJS 代码,则需要使用 ng-href 而不是 href

ng-href 指令确保了链接是正常的,即使在 AngularJS 执行代码前点击链接。

语法

<a ng-href="string"></a>

<a> 元素支持该指令。

参数值

描述
expression 字符串,表达式的执行结果

点击查看所有 AngularJS 教程 文章: https://www.codercto.com/courses/l/36.html

查看所有标签

Handbook of Data Structures and Applications

Handbook of Data Structures and Applications

Dinesh P. Mehta / Chapman and Hall/CRC / 2004-10-28 / USD 135.95

In the late sixties, Donald Knuth, winner of the 1974Turing Award, published his landmark book The Art of Computer Programming: Fundamental Algorithms. This book brought to- gether a body of kno......一起来看看 《Handbook of Data Structures and Applications》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具