O'Reilly logo

Dart Essentials by Martin Sikora

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extending the to-do list

We can keep index.html as is and start by adding routing to our main.dart file:

// web/main.dart moduleRouteInitializer(Router router, RouteViewFactory views) { views.configure({ // This route will be displayed even when no path is set. 'add': ngRoute( defaultRoute: true, path: '/add', view: 'view/add.html'), // Detail of a task identified by its id. 'detail': ngRoute( path: '/detail/:taskId', view: 'view/detail.html'), }); } class MyAppModule extends Module { MyAppModule() { bind(TodoListComponent); bind(TodoDetailComponent); // Initialize routes. bind(RouteInitializerFn, toValue: moduleRouteInitializer); // Turn on listening to Window.onHashChange event. bind(NgRoutingUsePushState, toValue: new NgRoutingUsePushState.value(false)); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required