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

Unified Diff: example/angular/routing/redirecting_to_a_new_route/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: Tweaks 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 side-by-side diff with in-line comments
Download patch
Index: example/angular/routing/redirecting_to_a_new_route/my_controller.dart
diff --git a/example/angular/components/creating_a_one_way_binding/my_controller.dart b/example/angular/routing/redirecting_to_a_new_route/my_controller.dart
similarity index 51%
copy from example/angular/components/creating_a_one_way_binding/my_controller.dart
copy to example/angular/routing/redirecting_to_a_new_route/my_controller.dart
index 328a0ce17610c40269476b7e3487ac8827154470..cc1e77984e278c7730a124625ef179ac36b31c4c 100644
--- a/example/angular/components/creating_a_one_way_binding/my_controller.dart
+++ b/example/angular/routing/redirecting_to_a_new_route/my_controller.dart
@@ -6,14 +6,24 @@ library my_controller;
import 'package:angular/angular.dart';
+class Book {
+ String title, description;
+ Book(this.title, this.description);
+}
+
@NgController(
selector: '[my-controller]',
publishAs: 'ctrl'
)
class MyController {
- String text = 'Angular Dart';
-
- reverseText() {
- text = new String.fromCharCodes(text.codeUnits.reversed);
+ MyController(NgRoutingHelper locationService) {
+ Router router = locationService.router;
+ router.onRouteStart.listen((RouteStartEvent e) {
+ e.completed.then((_) {
+ if ('${e.uri}' == '/about') {
+ router.go('bio', {});
+ }
+ });
+ });
}
}

Powered by Google App Engine
This is Rietveld 408576698