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', {}); |
+ } |
+ }); |
+ }); |
} |
} |