Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Directives #1037

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/application.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
7 changes: 5 additions & 2 deletions lib/core/annotation_src.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
Expand Down
17 changes: 8 additions & 9 deletions lib/directive/a_href.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
part of angular.directive;

/**
* @ngdoc directive
* @name ng.directive:a
* @restrict E
* Modifies the default behavior of the HTML `<a>` element to allow for data binding.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not right.

Modifies the default behavior of HTML a element to prevent navigation from the current page in case href attribute is empty.

*
* @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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge the first sentence here with the above comment.

* modifies the default behavior of the `<a>` 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.:
* `<a href="" ng-click="model.save()">Save</a>`
* Example:
*
* <a href="" ng-click="model.save()">Save</a>
*/
@Decorator(selector: 'a[href]')
class AHref {
Expand Down
12 changes: 8 additions & 4 deletions lib/directive/module.dart
Original file line number Diff line number Diff line change
@@ -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.
*
Expand All @@ -13,7 +12,6 @@
* For example:
*
* <span ng-show="ctrl.isVisible">this text is conditionally visible</span>
*
*/
library angular.directive;

Expand Down Expand Up @@ -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);
Expand Down
13 changes: 6 additions & 7 deletions lib/directive/ng_bind.dart
Original file line number Diff line number Diff line change
@@ -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]',
Expand Down
Loading