aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMisko Hevery2010-11-04 14:24:31 -0700
committerMisko Hevery2010-11-04 14:24:31 -0700
commit47066e70e1621ff74bd2cd6b5853ca3c5841aba6 (patch)
tree5a653300650aad0a4f1d8a88c0998edc7ebfe1fe /src
parentc0d30aedfca89fee2e1fc3b0b2fc1e7bfcb008b1 (diff)
downloadangular.js-47066e70e1621ff74bd2cd6b5853ca3c5841aba6.tar.bz2
added documentation for ng:include and ng:widget and test for doc collector.
Diffstat (limited to 'src')
-rw-r--r--src/Angular.js14
-rw-r--r--src/validators.js4
-rw-r--r--src/widgets.js51
3 files changed, 56 insertions, 13 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 8997045b..0e26a829 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -144,13 +144,6 @@ var _undefined = undefined,
*
*
* @example
- * //TODO this example current doesn't show up anywhere because the overview template doesn't
- * // render it.
- *
- * The following example filter reverses a text string. In addition, it conditionally makes the
- * text upper-case (to demonstrate optional arguments) and assigns color (to demonstrate DOM
- * modification).
-
<script type="text/javascript">
angular.filter.reverse = function(input, uppercase, color) {
var out = "";
@@ -166,12 +159,17 @@ var _undefined = undefined,
return out;
};
</script>
+ The following example filter reverses a text string. In addition, it conditionally makes the
+ text upper-case (to demonstrate optional arguments) and assigns color (to demonstrate DOM
+ modification).
+
+ <hr/>
<span ng:non-bindable="true">{{"hello"|reverse}}</span>: {{"hello"|reverse}}<br>
<span ng:non-bindable="true">{{"hello"|reverse:true}}</span>: {{"hello"|reverse:true}}<br>
<span ng:non-bindable="true">{{"hello"|reverse:true:"blue"}}</span>:
{{"hello"|reverse:true:"blue"}}
- * //TODO: I completely dropped a mention of using the other option (setter method), it's
+ * @TODO: I completely dropped a mention of using the other option (setter method), it's
* confusing to have two ways to do the same thing. I just wonder if we should prefer using the
* setter way over direct assignment because in the future we might want to be able to intercept
* filter registrations for some reason.
diff --git a/src/validators.js b/src/validators.js
index 3eb11f78..fd18d66c 100644
--- a/src/validators.js
+++ b/src/validators.js
@@ -1,4 +1,4 @@
-foreach({
+extend(angularValidator, {
'noop': function() { return _null; },
'regexp': function(value, regexp, msg) {
@@ -132,4 +132,4 @@ foreach({
return inputState.error;
}
-}, function(v,k) {angularValidator[k] = v;});
+});
diff --git a/src/widgets.js b/src/widgets.js
index 5eda5345..7a06fd6c 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -244,13 +244,28 @@ angularWidget('option', function(){
});
-/*ng:doc
- * @type widget
- * @name ng:include
+/**
+ * @ngdoc widget
+ * @name angular.widget.ng:include
*
* @description
+ * Include external HTML fragment.
+ *
+ * Keep in mind that Same Origin Policy applies to included resources
+ * (e.g. ng:include won't work for file:// access).
+ *
+ * @param {string} src expression evaluating to URL.
+ * @param {Scope=} [scope=new_child_scope] expression evaluating to angular.scope
*
* @example
+ * <select name="url">
+ * <option value="angular.filter.date.html">date filter</option>
+ * <option value="angular.filter.html.html">html filter</option>
+ * <option value="">(blank)</option>
+ * </select>
+ * <tt>url = <a href="{{url}}">{{url}}</a></tt>
+ * <hr/>
+ * <ng:include src="url"></ng:include>
*
* @scenario
*/
@@ -299,6 +314,36 @@ angularWidget('ng:include', function(element){
}
});
+/**
+ * @ngdoc widget
+ * @name angular.widget.ng:switch
+ *
+ * @description
+ * Conditionally change the DOM structure.
+ *
+ * @usageContent
+ * <any ng:switch-when="matchValue1"/>...</any>
+ * <any ng:switch-when="matchValue2"/>...</any>
+ * ...
+ * <any ng:switch-when="matchValueN"/>...</any>
+ *
+ * @param {*} on expression to match against <tt>ng:switch-when</tt>.
+ *
+ * @example
+ <select name="switch">
+ <option>settings</option>
+ <option>home</option>
+ </select>
+ <tt>switch={{switch}}</tt>
+ </hr>
+ <ng:switch on="switch" >
+ <div ng:switch-when="settings">Settings Div</div>
+ <span ng:switch-when="home">Home Span</span>
+ </ng:switch>
+ </code>
+ *
+ * @scenario
+ */
var ngSwitch = angularWidget('ng:switch', function (element){
var compiler = this,
watchExpr = element.attr("on"),