案例:AngularJS案例     状态:可编辑再运行    进入横版
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<script src="/js/angular.js1.4.6/angular.min.js"></script>
6
</head>
7
<body ng-app="">
8
9
<div ng-init="myVar = 'https://www.w3xue.com'">
10
<h1>W3xue教程</h1>
11
<p>访问 <a ng-href="{{myVar}}">{{myVar}}</a> 学习!</p>
12
</div>
13
14
<p>该实例可以使用了原生的 href 属性,但在 AngularJS 中, ng-href 属性更安全。</p>
15
16
</body>
17
</html>
18

 运行结果 
 北美留学生论坛