A. L
A. L

Reputation: 12649

Angular 2 Routing index.html

I've done Angular's hero tutorial and have a basic understanding of routing. However, that seems to only route part of the page (functioning like some kind of iframe).

If I'm looking to basically route index.html, i.e. doing the traditional <a href> to another location (changing the entire page) how would I go about it?

In other words, if index.html contains <my-app></my-app> is it possible to have another component to have its selector as my-app also and have it called when an event occurs?

Upvotes: 3

Views: 5033

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 657318

That's not how routing is supposed to work and also HTML5 pushState itself doesn't support that. If you load a different page than index.html you're leaving the Angular2 application and loading an entirely different application. That's not what routing is about.

Angular2 is for SPA where the application is loaded and then the view is updated according to routing and component state, instead of reloading a page from the server after each or some user actions.

Upvotes: 2

Related Questions