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

Side by Side Diff: example/angular/routing/accessing_router_in_controller/my_controller.dart

Issue 135183008: First group of routing examples (Closed) Base URL: https://github.com/dart-lang/dart_by_example.git@master
Patch Set: Created 6 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library my_controller;
6
7 import 'package:angular/angular.dart';
8 import './book.dart' show Book;
9
10 @NgController(
11 selector: '[my-controller]',
12 publishAs: 'ctrl'
13 )
14 class MyController implements NgDetachAware {
15 RouteHandle route;
16 Book book;
17 Map<String, Book> bookMap = {
18 "1": new Book('War and Peace', 'A really long book'),
19 "2": new Book('The Old Man and the Sea', 'A really short book')
20 };
21
22 MyController(RouteProvider router) {
23 route = router.route.newHandle();
24
25 route.onRoute.listen((RouteEvent e) {
26 print(route.runtimeType);
pavelj 2014/01/21 21:59:59 remove
27 var _bookId = route.parameters['bookId'];
28 book = bookMap[_bookId];
29 });
30 }
31
32 detach() {
33 route.discard();
34 }
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698