Index: third_party/pkg/angular/lib/routing/module.dart |
diff --git a/third_party/pkg/angular/lib/routing/module.dart b/third_party/pkg/angular/lib/routing/module.dart |
index 23a2e3a4ddfb846f01223218900e90a77663d980..8df6967dac80070811e37539f2108c22ee81ab21 100644 |
--- a/third_party/pkg/angular/lib/routing/module.dart |
+++ b/third_party/pkg/angular/lib/routing/module.dart |
@@ -1,4 +1,6 @@ |
/** |
+ * Route configuration for single-page applications. |
+ * |
* The [routing] library makes it easier to build large single-page |
* applications. The library lets you map the browser address bar to semantic |
* structure of your application and keeps them in sync. |
@@ -7,7 +9,7 @@ |
* and to provide custom tools to make it easier to use routing with Angular |
* templates. |
* |
- * Lets consider a simple recipe book application. The application might have |
+ * Let's consider a simple recipe book application. The application might have |
* the following pages: |
* |
* * recipes list/search |
@@ -23,37 +25,37 @@ |
* * `/recipe/:recipeId/edit` |
* |
* |
- * Lets try to define those routes in Angular. To get started we need to |
+ * Let's try to define those routes in Angular. To get started we need to |
* provide an implementation of [RouteInitializerFn] function. |
* |
- * void initRoutes(Router router, ViewFactory view) { |
- * // define routes here. |
- * } |
- * |
- * var module = new Module() |
- * ..factory(RouteInitializerFn, (_) => initRoutes); |
- * |
- * Lets see how we could define our routes using the routing framework: |
- * |
- * void initRoutes(Router router, ViewFactory view) { |
- * router |
- * ..addRoute( |
- * name: 'recipes', |
- * path: '/recipes', |
- * enter: view('recipes.html')) |
- * ..addRoute( |
- * name: 'addRecipe', |
- * path: '/addRecipe', |
- * enter: view('addRecipe.html')) |
- * ..addRoute( |
- * name: 'viewRecipe', |
- * path: '/recipe/:recipeId/view', |
- * enter: view('viewRecipe.html')) |
- * ..addRoute( |
- * name: 'editRecipe', |
- * path: '/recipe/:recipeId/edit', |
- * enter: view('editRecipe.html')); |
- * } |
+ * void initRoutes(Router router, RouteViewFactory view) { |
+ * // define routes here. |
+ * } |
+ * |
+ * var module = new Module() |
+ * ..value(RouteInitializerFn, initRoutes); |
+ * |
+ * Let's see how we could define our routes using the routing framework: |
+ * |
+ * void initRoutes(Router router, RouteViewFactory view) { |
+ * router.root |
+ * ..addRoute( |
+ * name: 'recipes', |
+ * path: '/recipes', |
+ * enter: view('recipes.html')) |
+ * ..addRoute( |
+ * name: 'addRecipe', |
+ * path: '/addRecipe', |
+ * enter: view('addRecipe.html')) |
+ * ..addRoute( |
+ * name: 'viewRecipe', |
+ * path: '/recipe/:recipeId/view', |
+ * enter: view('viewRecipe.html')) |
+ * ..addRoute( |
+ * name: 'editRecipe', |
+ * path: '/recipe/:recipeId/edit', |
+ * enter: view('editRecipe.html')); |
+ * } |
* |
* We defined 4 routes and for each route we set views (templates) to be |
* displayed when that route is "entered". For example, when the browser URL |
@@ -64,7 +66,7 @@ |
* |
* Notice that `viewRecipe` and `editRecipe` route paths have `recipeId` |
* parameter in them. We need to be able to get hold of that parameter in |
- * order to know which recipe to load. Lets consider the following |
+ * order to know which recipe to load. Let's consider the following |
* `viewRecipe.html`. |
* |
* <view-recipe></view-recipe> |
@@ -73,21 +75,21 @@ |
* displaying the recipe. Now, our `view-recipe` can inject [RouteProvider] |
* to get hold of the route and its parameters. It might look like this: |
* |
- * @NgComponent(...) |
- * class ViewRecipeComponent { |
- * ViewRecipeComponent(RouteProvider routeProvider) { |
+ * @Component(...) |
+ * class ViewRecipe { |
+ * ViewRecipe(RouteProvider routeProvider) { |
* String recipeId = routeProvider.parameters['recipeId']; |
* _loadRecipe(recipeId); |
* } |
* } |
* |
* [RouteProvider] and [Route] can be used to control navigation, specifically, |
- * leaving of the route. For example, lets consider "edit recipe" component: |
+ * leaving of the route. For example, let's consider "edit recipe" component: |
* |
- * @NgComponent(...) |
- * class EditRecipeComponent implements NgDetachAware { |
+ * @Component(...) |
+ * class EditRecipe implements DetachAware { |
* RouteHandle route; |
- * EditRecipeComponent(RouteProvider routeProvider) { |
+ * EditRecipe(RouteProvider routeProvider) { |
* RouteHandle route = routeProvider.route.newHandle(); |
* _loadRecipe(route); |
* route.onLeave.listen((RouteEvent event) { |
@@ -116,35 +118,35 @@ |
* [RouteHandle.discard] unsubscribes all listeneters created for the handle. |
* |
* |
- * # Hierarchical Routes |
+ * ## Hierarchical Routes |
* |
* The routing framework allows us to define trees of routes. In our recipes |
* example we could have defined our routes like this: |
* |
- * void initRoutes(Router router, ViewFactory view) { |
- * router |
- * ..addRoute( |
- * name: 'recipes', |
- * path: '/recipes', |
- * enter: view('recipes.html')) |
- * ..addRoute( |
- * name: 'addRecipe', |
- * path: '/addRecipe', |
- * enter: view('addRecipe.html')) |
- * ..addRoute( |
- * name: 'recipe', |
- * path: '/recipe/:recipeId', |
- * mount: (Route route) => route |
- * ..addRoute( |
- * name: 'view', |
- * path: '/view', |
- * enter: view('viewRecipe.html')) |
- * ..addRoute( |
- * name: 'edit', |
- * path: '/edit', |
- * enter: view('editRecipe.html'))); |
+ * void initRoutes(Router router, RouteViewFactory view) { |
+ * router.root |
+ * ..addRoute( |
+ * name: 'recipes', |
+ * path: '/recipes', |
+ * enter: view('recipes.html')) |
+ * ..addRoute( |
+ * name: 'addRecipe', |
+ * path: '/addRecipe', |
+ * enter: view('addRecipe.html')) |
+ * ..addRoute( |
+ * name: 'recipe', |
+ * path: '/recipe/:recipeId', |
+ * mount: (Route route) => route |
+ * ..addRoute( |
+ * name: 'view', |
+ * path: '/view', |
+ * enter: view('viewRecipe.html')) |
+ * ..addRoute( |
+ * name: 'edit', |
+ * path: '/edit', |
+ * enter: view('editRecipe.html'))); |
* } |
- * } |
+ * |
*/ |
library angular.routing; |
@@ -152,16 +154,18 @@ import 'dart:async'; |
import 'dart:html'; |
import 'package:di/di.dart'; |
-import 'package:angular/angular.dart'; |
+import 'package:angular/application.dart'; |
+import 'package:angular/core/annotation_src.dart'; |
+import 'package:angular/core/module_internal.dart'; |
+import 'package:angular/core_dom/module_internal.dart'; |
import 'package:route_hierarchical/client.dart'; |
-export 'package:route_hierarchical/client.dart'; |
part 'routing.dart'; |
part 'ng_view.dart'; |
part 'ng_bind_route.dart'; |
-class NgRoutingModule extends Module { |
- NgRoutingModule({bool usePushState: true}) { |
+class RoutingModule extends Module { |
+ RoutingModule({bool usePushState: true}) { |
type(NgRoutingUsePushState); |
factory(Router, (injector) { |
var useFragment = !injector.get(NgRoutingUsePushState).usePushState; |
@@ -174,8 +178,8 @@ class NgRoutingModule extends Module { |
value(RouteInitializerFn, null); |
// directives |
- value(NgViewDirective, null); |
- type(NgBindRouteDirective); |
+ value(NgView, null); |
+ type(NgBindRoute); |
} |
} |
@@ -188,7 +192,7 @@ class NgRoutingModule extends Module { |
* "http://host:port/path#/foo/bar?baz=qux". Everything after hash (#) is used |
* by the router. |
*/ |
-@NgInjectableService() |
+@Injectable() |
class NgRoutingUsePushState { |
final bool usePushState; |
NgRoutingUsePushState(): usePushState = true; |