TdLoading Pipe or Directive when using an Angular async pipe
See original GitHub issueFeature Request
TdLoading Pipe or Directive
When using an asynchronous pipe in conjunction with an *ngFor it would be nice for the TdLoading service to track the start and end of an XHR request to the remote server.
What is the expected behavior?
If I use the following snippet of code the TdLoading pipe or service should be able to start an infinite progress indicator.
When the remote call is complete and the object list is available to be iterated over the progress indicator should disappear.
<div *ngFor="let item of items | async | tdLoading">
{{item.name}}
</div>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
AsyncPipe - Angular
The async pipe subscribes to an Observable or Promise and returns the latest value it has emitted. ... It's also possible to use...
Read more >Using the Async Pipe in Angular - Pluralsight
We can use the async pipe in Angular application by including the CommonModule which exports all the basic Angular directives and pipes, ...
Read more >Several Ways to Use Async Pipes in Angular - Medium
Using ng-container and * ngIf Directive. There is an additional way. This is using CombineLatest, the RxJS operator.
Read more >angular - problem binding pipe async inn custom directive input
I can see at least 2 possible ways of solving this. First. You can drop the use of a custom directive and rely...
Read more >Async Pipe: How to use it properly in Angular - malcoded
Also, we will learn how to use it with interpolation data binding and different directives like *ngIf and *ngFor. Ready? Let's get started!...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think that this approach would leave the least amount of questions about what is going on. The syntax is readable and leaves no room for interpretation. This approach also implies the developer use one loading service per item placed on the page without having to declare a named element to be resolved when the observable is returned.
Or
Where as this approach
<div *tdLoading="'name'; [new_input_here]: observable | async as items">might leave someone wondering why they would need to use the string name in the configuration of the loading service when the contained element is the target item they want the loading service to mask while loading is in progress.All the while I think that both approaches would provide great utility when binding to an observable data source.
Playing around with this, and i think it will be something like described before:
OR
Since when using the async pipe, what we get as input is
null, and then once its resolved we get what it returned as input.We can translate this as
trueorfalse(which will also be a way of using it)Diving in more 🤓