Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(649)

Unified Diff: third_party/pkg/angular/lib/routing/module.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/routing/module.dart
===================================================================
--- third_party/pkg/angular/lib/routing/module.dart (revision 33054)
+++ third_party/pkg/angular/lib/routing/module.dart (working copy)
@@ -1,11 +1,10 @@
/**
- * 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.
+ * 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.
*
- * Angular uses the [route_hierarchical] package to define application routes
- * and to provide custom tools to make it easier to use routing with Angular
- * templates.
+ * Angular uses the [route_hierarchical] package to define application routes 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
* the following pages:
@@ -24,35 +23,39 @@
*
*
* Lets try to define those routes in Angular. To get started we need to
- * provide an implementation of [RouteInitializerFn] function.
+ * provide an implementation of [RouteInitializer] interface.
*
- * void initRoutes(Router router, ViewFactory view) {
- * // define routes here.
- * }
+ * class RecipesRouteInitializer implements RouteInitializer {
+ * void init(Router router, ViewFactory view) {
+ * // define routes here.
+ * }
+ * }
*
* var module = new Module()
- * ..factory(RouteInitializerFn, (_) => initRoutes);
+ * ..type(RouteInitializer, implementedBy: RecipesRouteInitializer);
*
* 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'));
+ * class RecipesRouteInitializer implements RouteInitializer {
+ * void init(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'));
+ * }
* }
*
* We defined 4 routes and for each route we set views (templates) to be
@@ -121,30 +124,31 @@
* 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')));
+ * class RecipesRouteInitializer implements RouteInitializer {
+ * void init(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')));
+ * }
* }
- * }
*/
library angular.routing;
@@ -171,7 +175,6 @@
type(NgRoutingHelper);
value(RouteProvider, null);
value(RouteInitializer, null);
- value(RouteInitializerFn, null);
// directives
value(NgViewDirective, null);
« no previous file with comments | « third_party/pkg/angular/lib/playback/playback_http.dart ('k') | third_party/pkg/angular/lib/routing/ng_bind_route.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698