I'm in a big fix since this morning for a very silly reason. This should work but I don't understand whats stopping it. Anyways, code below
My Resolver:
export class UserResolver implements Resolve<any> {
constructor(private fakeApi: FakeApiService) { }
resolve():Observable<any> {
console.log('resolver method hit');
return Observable.empty();
}
}
My Module:
const routes: Routes = [
{path:'',component:UserComponent,resolve:{users:UserResolver}}
]
const leafManifest:IManifestCollection = [
{path:'',component:UserComponent}
]
Don't worry about the service or the calling component because they dont even come in to the picture. I am just calling this route and the resolve method is hit. However, the resolve method is not executed, it just jumps to the closing of the method and back to the calling component. In other words, if I place a debugger on resolver method, it is hit but never goes inside it. It just skips it , it seems.
So, as you can see it doesnt show any message like 'resolver method hit' in the console.
Yes, I have added UserResolver in providers of module.