Skip to content

Commit 76563f6

Browse files
jdavisp3jamesdaily
authored andcommitted
docs(ngHref): fix formatting and clarify
Closes angular#4106
1 parent 63759d5 commit 76563f6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/ng/directive/booleanAttrs.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
* @restrict A
77
*
88
* @description
9-
* Using Angular markup like {{hash}} in an href attribute makes
10-
* the page open to a wrong URL, if the user clicks that link before
11-
* angular has a chance to replace the {{hash}} with actual URL, the
12-
* link will be broken and will most likely return a 404 error.
9+
* Using Angular markup like `{{hash}}` in an href attribute will
10+
* make the link go to the wrong URL if the user clicks it before
11+
* Angular has a chance to replace the `{{hash}}` markup with its
12+
* value. Until Angular replaces the markup the link will be broken
13+
* and will most likely return a 404 error.
14+
*
1315
* The `ngHref` directive solves this problem.
1416
*
15-
* The buggy way to write it:
17+
* The wrong way to write it:
1618
* <pre>
1719
* <a href="http://www.gravatar.com/avatar/{{hash}}"/>
1820
* </pre>
@@ -26,7 +28,8 @@
2628
* @param {template} ngHref any string which can contain `{{}}` markup.
2729
*
2830
* @example
29-
* This example uses `link` variable inside `href` attribute:
31+
* This example shows various combinations of `href`, `ng-href` and `ng-click` attributes
32+
* in links and their different behaviors:
3033
<doc:example>
3134
<doc:source>
3235
<input ng-model="value" /><br />

0 commit comments

Comments
 (0)