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://codercto.com/courses/l/36.html

查看所有标签

Algorithms + Data Structures = Programs

Algorithms + Data Structures = Programs

Niklaus Wirth / Prentice Hall / 1975-11-11 / GBP 84.95

It might seem completely dated with all its examples written in the now outmoded Pascal programming language (well, unless you are one of those Delphi zealot trying to resist to the Java/.NET dominanc......一起来看看 《Algorithms + Data Structures = Programs》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具