@lotto24-angular/defer-queue
v0.6.1
Published
Orchestrate deferred components in Angular applications
Downloads
19
Maintainers
Readme
Defer-Queue for Angular
Usage
App configuration
In your App config, provide the defer queue:
export const appConfig = {
providers: [
provideRouter(
appRoutes,
),
provideDeferQueue(),
],
};
Component
In your component, inject the defer queue service
@Component({...})
export class SomeComponent {
protected readonly deferQueue = inject(DeferQueueService);
}
Template
- in your component's template, use the defer queue's trigger.
- add an identifier for this item. This improves logging, but it is also needed for the queue to work. You should also set a priority for this defer block.
3important: add the directive
[deferQueueResolve]
to your deferred component. The value should match the previous identifier. This will signal to the queue when the defer block is resolved.
@defer (when deferQueue.when('fruit0', 'lowest')) {
<imports-orchestrator-examples-fruit0-component deferQueueResolve="fruit0" />
}