diff --git a/lib/application.dart b/lib/application.dart index b6b972c2d..56ee41488 100644 --- a/lib/application.dart +++ b/lib/application.dart @@ -94,7 +94,7 @@ class AngularModule extends Module { AngularModule() { install(new CoreModule()); install(new CoreDomModule()); - install(new DecoratorFormatter()); + install(new DirectiveModule()); install(new FormatterModule()); install(new PerfModule()); install(new RoutingModule()); diff --git a/lib/core/annotation_src.dart b/lib/core/annotation_src.dart index 643339ca9..98664729a 100644 --- a/lib/core/annotation_src.dart +++ b/lib/core/annotation_src.dart @@ -547,8 +547,11 @@ abstract class DetachAware { } /** - * Use @[Formatter] annotation to register a new formatter. A formatter is a class - * with a [call] method (a callable function). + * Use the @[Formatter] class annotation to register a new formatter. + * + * A formatter is a pure function that performs a transformation on input data from an expression. + * For more on formatters in Angular, see the documentation for the + * [angular:formatter](#angular-formatter) library. * * Usage: * diff --git a/lib/directive/a_href.dart b/lib/directive/a_href.dart index 0241dfbb6..0f875dcf2 100644 --- a/lib/directive/a_href.dart +++ b/lib/directive/a_href.dart @@ -1,17 +1,16 @@ part of angular.directive; /** - * @ngdoc directive - * @name ng.directive:a - * @restrict E + * Modifies the default behavior of the HTML `` element to allow for data binding. * - * @description - * Modifies the default behavior of the html A tag so that the default action is - * prevented when the a href is empty or it contains `ng-click` directive. + * When an `href` tag is empty, or when used with `ng-click`, this directive intercepts and + * modifies the default behavior of the `` element. This change permits the easy + * creation of action links with the [OnClick] directive, without changing the location or causing + * a page reload. * - * This change permits the easy creation of action links with the `ngClick` - * directive without changing the location or causing page reloads, e.g.: - * `Save` +* Example: + * + * Save */ @Decorator(selector: 'a[href]') class AHref { diff --git a/lib/directive/module.dart b/lib/directive/module.dart index cceb47dcb..300dddeee 100644 --- a/lib/directive/module.dart +++ b/lib/directive/module.dart @@ -1,5 +1,4 @@ /** - * * Directives for [angular.dart](#angular/angular), a web framework for Dart. A directive attaches * a specified behavior to a DOM element. * @@ -13,7 +12,6 @@ * For example: * * this text is conditionally visible - * */ library angular.directive; @@ -54,8 +52,14 @@ part 'ng_form.dart'; part 'ng_model_validators.dart'; part 'ng_model_options.dart'; -class DecoratorFormatter extends Module { - DecoratorFormatter() { +/** + * This module registers all the Angular directives. + * + * When instantiating an Angular application through applicationFactory, + * DirectiveModule is automatically included. + */ +class DirectiveModule extends Module { + DirectiveModule() { bind(AHref, toValue: null); bind(NgBaseCss); // The root injector should have an empty NgBaseCss bind(NgBind, toValue: null); diff --git a/lib/directive/ng_bind.dart b/lib/directive/ng_bind.dart index 04346cb0e..99af17679 100644 --- a/lib/directive/ng_bind.dart +++ b/lib/directive/ng_bind.dart @@ -1,19 +1,18 @@ part of angular.directive; /** - * The ngBind attribute tells Angular to replace the text content of the - * specified HTML element with the value of a given expression, and to update - * the text content when the value of that expression changes. + * Replaces the text content of the specified HTML element with the value of a given expression, + * and updates the text content when the value of that expression changes. * * Typically, you don't use ngBind directly, but instead you use the double - * curly markup like {{ expression }} which is similar but less verbose. + * curly markup like `{{ expression }}` which is similar but less verbose. * - * It is preferrable to use ngBind instead of {{ expression }} when a template + * It is preferrable to use `ng-bind` instead of `{{ expression }}` when a template * is momentarily displayed by the browser in its raw state before Angular - * compiles it. Since ngBind is an element attribute, it makes the bindings + * compiles it. Since `ng-bind` is an element attribute, it makes the bindings * invisible to the user while the page is loading. * - * An alternative solution to this problem would be using the ngCloak directive. + * An alternative solution to this problem would be using the [ngCloak] directive. */ @Decorator( selector: '[ng-bind]', diff --git a/lib/directive/ng_model.dart b/lib/directive/ng_model.dart index b3c9e5564..4571ee8f3 100644 --- a/lib/directive/ng_model.dart +++ b/lib/directive/ng_model.dart @@ -1,10 +1,10 @@ part of angular.directive; /** - * NgModelConverter is the class interface for performing transformations on - * the viewValue and modelValue properties on a model. A new converter can be created - * by implementing the NgModelConverter class and then attaching to a model via the - * provided setter. + * Class interface for performing transformations on the viewValue and modelValue properties on a model. + * + * A new converter can be created by implementing the NgModelConverter class and then attaching to + * a model via the provided setter. */ abstract class NgModelConverter { String get name; @@ -18,6 +18,7 @@ class _NoopModelConverter extends NgModelConverter { /** * Ng-model directive is responsible for reading/writing to the model. + * * The directive itself is headless. (It does not know how to render or what * events to listen for.) It is meant to be used with other directives which * provide the rendering and listening capabilities. The directive itself @@ -69,7 +70,7 @@ class NgModel extends NgControl implements AttachAware { } /** - * Resets the model value to it's original (pristine) value. If the model has been interacted + * Resets the model value to its original (pristine) value. If the model has been interacted * with by the user at all then the model will be also reset to an "untouched" state. */ void reset() { @@ -263,7 +264,10 @@ class NgModel extends NgControl implements AttachAware { } /** - * Usage: + * Creates a two-way databinding between the `ng-model` expression + * and the checkbox input element state. + * + * **Usage** * * * - * This creates a two way databinding between the `ng-model` expression - * and the checkbox input element state. + * If the optional `ng-true-value` is absent, + * - if the model expression evaluates to true or to a nonzero [:num:], + * then the checkbox is checked + * - otherwise, the checkbox is unchecked * - * If the optional `ng-true-value` is absent then: if the model expression - * evaluates to true or to a nonzero [:num:], then the checkbox is checked; - * otherwise, it is unchecked. + * If `ng-true-value="t_expr"` is present, + * - if the model expression evaluates to the same value as `t_expr`, then the checkbox is checked + * - otherwise, it is unchecked. * - * If `ng-true-value="t_expr"` is present, then: if the model expression - * evaluates to the same value as `t_expr` then the checkbox is checked; - * otherwise, it is unchecked. + * When the checkbox is checked, + * - the model is set to the value of `t_expr` if present + * - otherwise, the model is set to `true` * - * When the checkbox is checked, the model is set to the value of `t_expr` if - * present, true otherwise. When unchecked, it is set to the value of - * `f_expr` if present, false otherwise. + * When the checkbox is unchecked, + * - the model is set to the value of `f_expr` if present + * - otherwise, the model is set to false. * * Also see [NgTrueValue] and [NgFalseValue]. */ @@ -318,16 +324,18 @@ class InputCheckbox { /** - * Usage: + * Creates a two-way databinding between the `ng-model` expression + * and the `` or ` * - * This creates a two-way binding between any string-based input element - * (both `` and `