fixed example rendering, add tests for it.

This commit is contained in:
Misko Hevery
2011-01-19 15:42:11 -08:00
parent 5d0d34ae72
commit c2f2587a79
46 changed files with 512 additions and 477 deletions

View File

@@ -4,19 +4,19 @@
@namespace Namespace for all widgets.
@description
# Overview
Widgets allow you to create DOM elements that the browser doesn't
already understand. You create the widget in your namespace and
assign it behavior. You can only bind one widget per DOM element
(unlike directives, in which you can use any number per DOM
element). Widgets are expected to manipulate the DOM tree by
Widgets allow you to create DOM elements that the browser doesn't
already understand. You create the widget in your namespace and
assign it behavior. You can only bind one widget per DOM element
(unlike directives, in which you can use any number per DOM
element). Widgets are expected to manipulate the DOM tree by
adding new elements whereas directives are expected to only modify
element properties.
Widgets come in two flavors: element and attribute.
# Element Widget
Let's say we would like to create a new element type in the
namespace `my` that can watch an expression and alert() the user
Let's say we would like to create a new element type in the
namespace `my` that can watch an expression and alert() the user
with each new value.
<pre>
@@ -38,7 +38,7 @@ angular.widget('my:watch', function(compileElement) {
</pre>
# Attribute Widget
Let's implement the same widget, but this time as an attribute
Let's implement the same widget, but this time as an attribute
that can be added to any existing DOM element.
<pre>
&lt;div my-watch="name"&gt;text&lt;/div&gt;
@@ -70,4 +70,4 @@ angular.widget('@my:watch', function(expression, compileElement) {
});
</script>
<my:time></my:time>