Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);
}
like image 465
Murhaf Sousli Avatar asked Nov 01 '15 21:11

Murhaf Sousli


People also ask

What is routing in angular2?

Routing helps in directing users to different pages based on the option they choose on the main page. Hence, based on the option they choose, the required Angular Component will be rendered to the user. Let's see the necessary steps to see how we can implement routing in an Angular 2 application.

What is routing in angular8?

The process of defining navigation element and the corresponding view is called Routing. Angular provides a separate module, RouterModule to set up the navigation in the Angular application.

What is routing in ionic?

Navigation means how a user can move between different pages in the ionic application. In Ionic 4, the navigation has received many changes. For example, instead of using the Ionics own navController, the v4 is able to integrate with the official Angular Router.

What is LoadChildren in Angular routing?

Use LoadChildren:For lazy loading. Using this property will optimize your application's performance by only loading the nested route subtree when a user navigates to a particular URL that matches the current route path. It helps in keeping the nested routes table separate.


1 Answers

Try this HashLocationStrategy example.

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

like image 115
Christoph Lachenicht Avatar answered Oct 23 '22 22:10

Christoph Lachenicht