aboutsummaryrefslogtreecommitdiffstats
path: root/src/markups.js
diff options
context:
space:
mode:
authorMisko Hevery2010-11-12 15:16:33 -0800
committerMisko Hevery2010-11-15 10:04:17 -0800
commit7e6f9992216157a10a64a86fe526f61f9f57e43f (patch)
treee172da3909e44e8eb9a80eb86880fbb9cd814290 /src/markups.js
parent625cc7609cfd1a0a4fcecfd55875e548518a72a8 (diff)
downloadangular.js-7e6f9992216157a10a64a86fe526f61f9f57e43f.tar.bz2
added remaining directives and search box.
Diffstat (limited to 'src/markups.js')
-rw-r--r--src/markups.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/markups.js b/src/markups.js
index 159d7b12..57a209b7 100644
--- a/src/markups.js
+++ b/src/markups.js
@@ -68,6 +68,57 @@ angularTextMarkup('OPTION', function(text, textNode, parentElement){
}
});
+/**
+ * @ngdoc directive
+ * @name angular.directive.ng:href
+ *
+ * @description
+ * Using <angular/> 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 `ng:href` solves this problem by placing the `href` in the
+ * `ng:` namespace.
+ *
+ * The buggy way to write it:
+ * <pre>
+ * <a href="http://www.gravatar.com/avatar/{{hash}}"/>
+ * </pre>
+ *
+ * The correct way to write it:
+ * <pre>
+ * <a ng:href="http://www.gravatar.com/avatar/{{hash}}"/>
+ * </pre>
+ *
+ * @element ANY
+ * @param {template} template any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name angular.directive.ng:src
+ *
+ * @description
+ * Using <angular/> markup like `{{hash}}` in a `src` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until <angular/> replaces the expression inside
+ * `{{hash}}`. The `ng:src` attribute solves this problem by placing
+ * the `src` attribute in the `ng:` namespace.
+ *
+ * The buggy way to write it:
+ * <pre>
+ * <img src="http://www.gravatar.com/avatar/{{hash}}"/>
+ * </pre>
+ *
+ * The correct way to write it:
+ * <pre>
+ * <img ng:src="http://www.gravatar.com/avatar/{{hash}}"/>
+ * </pre>
+ *
+ * @element ANY
+ * @param {template} template any string which can contain `{{}}` markup.
+ */
+
var NG_BIND_ATTR = 'ng:bind-attr';
var SPECIAL_ATTRS = {'ng:src': 'src', 'ng:href': 'href'};
angularAttrMarkup('{{}}', function(value, name, element){