Open
Description
Loaders can be used to fetch data for the component, run checks such as auth, redirect, and more.
import { Component } from '@angular/core';
@Component({
template: `
<router>
<route path="/lazy"
[load]="components.lazy"
[loader]="() => Promise<Response> | Observable<Response>">
</route>
</router>
`,
})
export class MyComponent {
data$: Observable<Data> = getLoaderData();
constructor(private loaderData$: LoaderData) {}
components = {
lazy: () => import('./lazy/lazy.component')
};
}
Activity
mainawycliffe commentedon Jul 11, 2022
@brandonroberts I am looking to familiarize myself with the inner working of this project, would you mind if I took a crack at this.
brandonroberts commentedon Jul 11, 2022
Cool @mainawycliffe. You're welcome to, but I wouldn't put too much effort into it at the moment. I'm still evaluating this vs alternative options for routing
mainawycliffe commentedon Jul 11, 2022
@brandonroberts Thanks. That looks interesting, will take a look while I get a chance. If it's what I think it is, I am really looking forward to it.