D
D
DenPolosin2016-04-10 15:27:25
Angular
DenPolosin, 2016-04-10 15:27:25

Why does routing not work, everything seems to be correct?

Plunker example:
embed.plnkr.co/sF9Use
plnkr.co/edit/sF9Use

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Zuev, 2016-04-10
@DenPolosin

The console shows you an error, is everything in order?
Try to add LocationStrategy initialization in main.ts

import {bootstrap} from 'angular2/platform/browser';
import {App} from './app';
import {ROUTER_PROVIDERS, LocationStrategy, HashLocationStrategy} from 'angular2/router';
import {provide} from 'angular2/core';

bootstrap(App, [
  ROUTER_PROVIDERS,
  provide(LocationStrategy, { useClass: HashLocationStrategy })])
  .catch(err => console.error(err));

Well, or PathLocationStrategy , if you want without hashes
plnkr.co/edit/ZBJHd3CTFCNzTx6cu8c1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question