All Questions

117
votes
24answers
75857 views

Angular 2.0 router not working on reloading the browser

I am using Angular 2.0.0-alpha.30 version. When redirect to a different route, then refresh the browser , its showing Cannot GET /route. Can you help me with figuring why this error happened.
76
votes
7answers
59267 views

Angular 2: 404 error occur when I refresh through the browser

I'm new to Angular 2. I have stored my single-page application in my server within a folder named as "myapp". I have changed the URL in the base to http://example.com/myapp/`. My project have two pag...
91
votes
9answers
76684 views

How do I create a singleton service in Angular 2?

I've read that injecting when bootstrapping should have all children share the same instance, but my main and header components (main app includes header component and router-outlet) are each getting ...
75
votes
3answers
50056 views

Show loading screen when navigating between routes in Angular 2

How do I show a loading screen when I change a route in Angular 2?
34
votes
3answers
17596 views

Angular 2 unit testing components with routerLink

I am trying to test my component with angular 2 final, but I get an error because the component uses the routerLink directive. I get the following error: Can't bind to 'routerLink' since it isn't ...
28
votes
3answers
18299 views

Passing data into "router-outlet" child components (angular 2)

I've got a parent component that goes to the server and fetches an object. // parent component @Component({ selector : 'node-display', template : ` <router-outlet [node]="node">...
180
votes
22answers
97474 views

In Angular, how do you determine the active route?

NOTE: There are many different answers here, and most have been valid at one time or another. The fact is that what works has changed a number of times as the Angular team has changed its Router. The...
35
votes
4answers
21070 views

Warn user of unsaved changes before leaving page

I would like to warn users of unsaved changes before they leave a particular page of my angular 2 app. Normally I would use window.onbeforeunload, but that doesn't work for single page applications. ...
38
votes
5answers
45435 views

Angular 2 router event listener

How to listen state change in Angular 2 router? In Angular 1.x I used this event: $rootScope.$on('$stateChangeStart', function(event,toState,toParams,fromState,fromParams, options){ ... }) So,...
41
votes
5answers
51434 views

Angular2 multiple router-outlet in the same template

Is it possible to have a multiple router-outlet in the same template? if yes then how to configure the routes? I am using angular2 beta. Thanks.

Previous Next