Index: example/angular/routing/redirecting_to_a_new_route/my_controller.dart |
diff --git a/example/angular/basics/setting_element_classes_using_a_list/my_controller.dart b/example/angular/routing/redirecting_to_a_new_route/my_controller.dart |
similarity index 51% |
copy from example/angular/basics/setting_element_classes_using_a_list/my_controller.dart |
copy to example/angular/routing/redirecting_to_a_new_route/my_controller.dart |
index 0d02bac2bc7ad2d74b802281d53c342da7b3addf..f78c068a448dde4cfdd5856e4985758748a34471 100644 |
--- a/example/angular/basics/setting_element_classes_using_a_list/my_controller.dart |
+++ b/example/angular/routing/redirecting_to_a_new_route/my_controller.dart |
@@ -6,22 +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 style1 = '', style2 = '', style3 = ''; |
- |
- boldAndStrike() { |
- style1 = 'bold'; style2 = 'strike'; style3 = ''; |
- } |
- |
- boldAndRed() { |
- style1 = 'bold'; style2 = ''; style3 = 'red'; |
- } |
- |
- strikeAndRed() { |
- style1 = ''; style2 = 'strike'; style3 = 'red'; |
+ MyController(NgRoutingHelper locationService) { |
+ Router router = locationService.router; |
+ router.onRouteStart.listen((RouteStartEvent e) { |
+ e.completed.then((_) { |
+ if ('${e.uri}'.endsWith('about')) { |
+ router.go('bio', {}); |
+ } |
+ }); |
+ }); |
} |
} |