Index: example/angular/routing/accessing_route_params_within_components/book_component.dart |
diff --git a/example/angular/routing/accessing_route_params_within_components/book_component.dart b/example/angular/routing/accessing_route_params_within_components/book_component.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3bb76e3dc73601a24a4ca53fe1df99fc09f168ac |
--- /dev/null |
+++ b/example/angular/routing/accessing_route_params_within_components/book_component.dart |
@@ -0,0 +1,25 @@ |
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+library book_component; |
+ |
+import 'package:angular/angular.dart'; |
+import 'book.dart' show Book; |
+ |
+@NgComponent( |
+ selector: 'book-component', |
+ templateUrl: './book_component.html', |
+ publishAs: 'cmp' |
+) |
+class BookComponent { |
+ @NgTwoWay('book-map') |
+ Map<String, Book> bookMap; |
+ String _bookId; |
+ |
+ BookComponent(RouteProvider routeProvider) { |
+ _bookId = routeProvider.parameters['bookId']; |
+ } |
+ |
+ Book get book => bookMap[_bookId]; |
+} |