Questions tagged [angular2-resolve]

7 questions
8
votes
1 answer

Applying a Resolve to root component in Angular2

In Angular2 we can use Resolve as follows: import { UserResolver } from './resolvers/user.resolver.ts'; export const routes: RouterConfig = [ { path: 'users/:id', component: UserComponent, resolve: { transaction: UserResolver …
joshcomley
  • 28,099
  • 24
  • 107
  • 147
3
votes
0 answers

Angular: Resolver delays component load even after the service has returned

I have some data that has to be loaded before the page loads and I'm using route resolvers to achieve this. Below is my code. Service: getUsernamesAndBUs(): Observable { return Observable.forkJoin( …
karthikaruna
  • 3,042
  • 7
  • 26
  • 37
3
votes
2 answers

Using Resolve to stop a route change

I have an angular2 app which lists a number of items, which the user can click to get more details about the item. Now, some of these items I don't actually have details for - which I'll know when I make the service request, and so instead of…
Haedrian
  • 4,240
  • 2
  • 32
  • 53
2
votes
1 answer

Angular: Differentiate between a parameter and child route

I have a situation where, I want a resolver if the child route is a param, and not if it's a path segment. Below is my code. { path: 'agreement', children: [ { path: ':id', component: AgreementComponent, …
karthikaruna
  • 3,042
  • 7
  • 26
  • 37
2
votes
1 answer

Angular2 router with Http data service through a Resolve with Observable catching 404

In my resolve guard I am getting an Http Observable to return the JSON of a user from a particular id. I want to catch an error and reroute to the users overview if the id does not exist. I have seen code that solves that with a Promise, but not…
0
votes
1 answer

Chain observables in sequence and return value from last call

I have a route resolver where I need to make two method calls in sequence that both return observables. I do not need to do anything with the response from the first call, but I would like to return to the component for the route the data that comes…
user1373121
  • 999
  • 4
  • 13
  • 22
0
votes
1 answer

Angular2 Routing-Resolve interface usage with OpaqueToken

I want to fetch data before an route/component is instantiated. Therefore I want to use the "Resolver"-Interface from the Angular2-Routing-Module. Take a look at my code. Its working with a string as the provider name, but throwing errors if I use…