@@ -374,18 +374,28 @@ angularDirective("ng:bind-template", function(expression, element){
374
374
*
375
375
* Instead of writing `ng:bind-attr` statements in your HTML, you can use double-curly markup to
376
376
* specify an <tt ng:non-bindable>{{expression}}</tt> for the value of an attribute.
377
- * At compile time, the attribute is translated into an `<span ng:bind-attr="{attr:expression}"/>`
377
+ * At compile time, the attribute is translated into an
378
+ * `<span ng:bind-attr="{attr:expression}"></span>`.
378
379
*
379
380
* The following HTML snippet shows how to specify `ng:bind-attr`:
380
381
* <pre>
381
- * <a href=" http://www.google.com/search?q={{query}}">Google</a>
382
+ * <a ng:bind-attr='{"href":" http://www.google.com/search?q={{query}}" }' >Google</a>
382
383
* </pre>
383
384
*
384
- * During compilation, the snippet gets translated to the following:
385
+ * This is cumbersome, so as we mentioned using double-curly markup is a prefered way of creating
386
+ * this binding:
385
387
* <pre>
386
- * <a ng:bind-attr='{"href":" http://www.google.com/search?q={{query}}" }' >Google</a>
388
+ * <a href=" http://www.google.com/search?q={{query}}">Google</a>
387
389
* </pre>
388
390
*
391
+ * During compilation, the template with attribute markup gets translated to the ng:bind-attr form
392
+ * mentioned above.
393
+ *
394
+ * _Note_: You might want to consider using {@link angular.directive.ng:href ng:href} instead of
395
+ * `href` if the binding is present in the main application template (`index.html`) and you want to
396
+ * make sure that a user is not capable of clicking on raw/uncompiled link.
397
+ *
398
+ *
389
399
* @element ANY
390
400
* @param {string } attribute_json one or more JSON key-value pairs representing
391
401
* the attributes to replace with expressions. Each key matches an attribute
@@ -406,7 +416,11 @@ angularDirective("ng:bind-template", function(expression, element){
406
416
<div ng:controller="Ctrl">
407
417
Google for:
408
418
<input type="text" ng:model="query"/>
419
+ <a ng:bind-attr='{"href":"http://www.google.com/search?q={{query}}" }'>
420
+ Google
421
+ </a> (ng:bind-attr) |
409
422
<a href="http://www.google.com/search?q={{query}}">Google</a>
423
+ (curly binding in attribute val)
410
424
</div>
411
425
</doc:source>
412
426
<doc:scenario>
0 commit comments