forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.directive.ng:href.html
23 lines (22 loc) · 1.21 KB
/
angular.directive.ng:href.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<h1>angular.directive.ng:href</h1>
<fieldset class="workInProgress"><legend>Work in Progress</legend>
This page is currently being revised. It might be incomplete or contain inaccuracies.</fieldset>
<h2>Description</h2>
<p>Using <tt><angular/></tt> markup like {{hash}} in an href attribute makes
the page open to a wrong URL, ff the user clicks that link before
angular has a chance to replace the {{hash}} with actual URL, the
link will be broken and will most likely return a 404 error.
The <code>ng:href</code> solves this problem by placing the <code>href</code> in the
<code>ng:</code> namespace.</p>
<p>The buggy way to write it:</p><div ng:non-bindable><pre class="brush: js; html-script: true;">
<a href="http://www.gravatar.com/avatar/{{hash}}"/>
</pre></div><p>The correct way to write it:</p><div ng:non-bindable><pre class="brush: js; html-script: true;">
<a ng:href="http://www.gravatar.com/avatar/{{hash}}"/>
</pre></div><h2>Usage</h2>
<pre class="brush: js; html-script: true;"><ANY ng:href="template">
...
</ANY></pre>
<h3>Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">template – {template} – </code>
any string which can contain <code>{{}}</code> markup.</li>
</ul>