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

Commit

Permalink
chore(docs): Added missing docs for a few route entries
Browse files Browse the repository at this point in the history
  • Loading branch information
naomiblack committed Oct 10, 2014
1 parent 96c0bcc commit a30986b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
25 changes: 15 additions & 10 deletions lib/routing/module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
* }
* }
*
* [RouteProvider] and [Route] can be used to control navigation, specifically,
* [RouteProvider] and `Route` can be used to control navigation, specifically,
* leaving of the route. For example, let's consider "edit recipe" component:
*
* @Component(...)
Expand All @@ -96,16 +96,16 @@
* }
* }
*
* [Route.onPreLeave] event is triggered when the browser is routed from an
* `Route.onPreLeave` event is triggered when the browser is routed from an
* active route to a different route. The active route can delay and
* potentially veto the navigation by passing a [Future<bool>] to
* [RoutePreLeaveEvent.allowLeave].
* potentially veto the navigation by passing a `Future<bool>` to
* `RoutePreLeaveEvent.allowLeave`.
*
* Notice that we create a [RouteHandle] for our route. [RouteHandle] are
* a convenient wrapper around [Route] that makes unsubscribing route events
* Notice that we create a [RouteHandle] for our route. `RouteHandle` are
* a convenient wrapper around `Route` that makes unsubscribing route events
* easier. For example, notice that we didn't need to manually call
* [StreamSubscription.cancel] for subscription to [Route.onPreLeave]. Calling
* [RouteHandle.discard] unsubscribes all listeners created for the handle.
* `StreamSubscription.cancel` for subscription to `Route.onPreLeave`. Calling
* `RouteHandle.discard` unsubscribes all listeners created for the handle.
*
* ## Hierarchical Routes
*
Expand Down Expand Up @@ -142,6 +142,11 @@ part 'routing.dart';
part 'ng_view.dart';
part 'ng_bind_route.dart';
/**
* A module that defines all necessary bindings for Angular routing. This
* module is included in [AngularModule] and typically you don't need to
* install it manually.
*/
class RoutingModule extends Module {
RoutingModule({bool usePushState: true}) {
bind(NgRoutingUsePushState);
Expand All @@ -162,10 +167,10 @@ class RoutingModule extends Module {

/**
* Allows configuration of [Router.useFragment]. By default [usePushState] is
* true, so the router will listen to [Window.onPopState] and route URLs like
* true, so the router will listen to `Window.onPopState` and route URLs like
* "http://host:port/foo/bar?baz=qux". Both the path and query parts of the URL
* are used by the router. If [usePushState] is false, router will listen to
* [Window.onHashChange] and route URLs like
* `Window.onHashChange` and route URLs like
* "http://host:port/path#/foo/bar?baz=qux". Everything after hash (#) is used
* by the router.
*/
Expand Down
4 changes: 2 additions & 2 deletions lib/routing/ng_view.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
part of angular.routing;

/**
* A directive that works with the [Router] and loads the template associated with the current
* A directive that works with the `Router` and loads the template associated with the current
* route.
*
* <ng-view></ng-view>
Expand Down Expand Up @@ -198,7 +198,7 @@ class NgView implements DetachAware, RouteProvider {
*/
abstract class RouteProvider {
/**
* Returns [Route] for current view.
* Returns `Route` for current view.
*/
Route get route;

Expand Down
13 changes: 12 additions & 1 deletion lib/routing/routing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ class RouteViewFactory {
}
}

/**
* A factory function for [NgRouteCfg]. Most of the parameters are passes directly
* to route_hierachical API for route configuration (`Route.addRoute`).
*
* * [view] - a URL of the template to load into ng-view when route is entered.
* * [viewHtml] - HTML of the template to load into ng-view when route is entered.
* * [modules] - a list of di modules to load for the route/ng-view.
*/
NgRouteCfg ngRoute({String path, String view, String viewHtml,
Map<String, NgRouteCfg> mount, modules(), bool defaultRoute: false,
RoutePreEnterEventHandler preEnter, RouteEnterEventHandler enter,
Expand All @@ -79,7 +87,10 @@ NgRouteCfg ngRoute({String path, String view, String viewHtml,
new NgRouteCfg(path: path, view: view, viewHtml: viewHtml, mount: mount,
modules: modules, defaultRoute: defaultRoute, preEnter: preEnter, preLeave: preLeave,
enter: enter, leave: leave, dontLeaveOnParamChanges: dontLeaveOnParamChanges);

/**
* Object containing route configuration parameters. Typically this class
* is not used directly, but rather constructed via [ngRoute] factory function.
*/
class NgRouteCfg {
final String path;
final String view;
Expand Down

0 comments on commit a30986b

Please sign in to comment.