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

Unified Diff: third_party/pkg/route_hierarchical/example/basic/example.dart

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 12 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: third_party/pkg/route_hierarchical/example/basic/example.dart
diff --git a/third_party/pkg/route_hierarchical/example/basic/example.dart b/third_party/pkg/route_hierarchical/example/basic/example.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e7f44e338b53d79a94d40050d948763b9a5a5a8f
--- /dev/null
+++ b/third_party/pkg/route_hierarchical/example/basic/example.dart
@@ -0,0 +1,36 @@
+library example;
+
+import 'dart:html';
+
+import 'package:logging/logging.dart';
+import 'package:route_hierarchical/client.dart';
+
+main() {
+ new Logger('')
+ ..level = Level.FINEST
+ ..onRecord.listen((r) => print('[${r.level}] ${r.message}'));
+
+ query('#warning').remove();
+
+ var router = new Router(useFragment: true);
+ router.root
+ ..addRoute(name: 'one', defaultRoute: true, path: '/one', enter: showOne)
+ ..addRoute(name: 'two', path: '/two', enter: showTwo);
+
+ query('#linkOne').attributes['href'] = router.url('one');
+ query('#linkTwo').attributes['href'] = router.url('two');
+
+ router.listen();
+}
+
+void showOne(RouteEvent e) {
+ print("showOne");
+ query('#one').classes.add('selected');
+ query('#two').classes.remove('selected');
+}
+
+void showTwo(RouteEvent e) {
+ print("showTwo");
+ query('#one').classes.remove('selected');
+ query('#two').classes.add('selected');
+}

Powered by Google App Engine
This is Rietveld 408576698