Murhaf Sousli Murhaf Sousli - 1 month ago 29
Dart Question

Routing in angular2 with Dart

I'm new to Angular2, till now I got succeeded to write the 5 Min Quickstart.

I want to learn how to use routing in Angular2 and Dart, unfortunately I couldn't find any example on the web yet. most of the articles are talking about routing with typescript which I couldn't get it work with dart.

I'm using webstorm with dart plugin.

import 'dart:html';
import 'package:angular2/angular2.dart';
import 'package:angular2/bootstrap.dart';
import 'package:angular2/router.dart';

@Component(selector: 'my-app', template: '<h1>My First Angular 2 App</h1>')
class AppComponent {}

void main() {
bootstrap(AppComponent);
}

Answer

Try this HashLocationStrategy example.

https://github.com/ng2-dart-samples/todomvc