110 questions
1
vote
1
answer
52
views
Initial value not displayed on mat-select component using async pipe
I'm trying to use a material select component that gets its values through an Observable with async pipe.
template:
<mat-form-field>
<mat-select
value="selectedOption$ | async&...
1
vote
0
answers
43
views
"Angular HttpClient data inconsistency after page refresh: duplicate or missing entries in list"
I'm working on an Angular project where I display a list of tables at the top of the page. When I click on a table name, I use Angular's HttpClient and ActivatedRoute to fetch the selected table's ...
3
votes
3
answers
190
views
Async pipe not working when using an observable created from a ControlValueAccessor control's valueChanges
I have a ControlValueAccesor with one FormControl. I need to create a new observable from the control's valueChanges and use it in the template via AsyncPipe. So in CVA's writeValue I update the form ...
2
votes
3
answers
138
views
How to modify data in an angular component when using async pipe
I have an Angular 18 component that receives an observable, which I render on the page using an async pipe. I want to be able to modify the data within this component and then press a "Save"...
0
votes
1
answer
61
views
What is wrong with my Angular EventEmitter subscription via the async pipe?
The setup
In a component, I have an EventEmitter which emits upon every change of a bound Input (id)
I have defined another variable which pipes that input value into a switchMap, which then fires ...
0
votes
1
answer
512
views
How to use the @if angular with async pipe and alias for else block?
I have the follow case, when @if validatior (introduced in angular 17) is used with else block, is validated with an observable and using an alias in order to avoid multiple subscriptions, What is the ...
1
vote
1
answer
188
views
How to use the AsyncPipe with ngComponentOutlet
I want to build a UI dynamically based on a JSON config. Trying to use ngComponentOutlet with the AsyncPipe so I can import(...) the components lazily. My implementation is not working (see example on ...
1
vote
2
answers
4k
views
Angular new control flow @for with async pipe and aliasing variable with as
I migrated from the structural directives *ngIf and *ngFor to the new control flow with @if and @for in Angular.
But there is one case that I used previously but I cannot seem to get it to work with ...
1
vote
2
answers
171
views
Async pipe not updating view although subscribing and using the latest value of the attribute works in Angular
Consider the below snapshot that does't work:
Parent.ts
allowed$ : Observable<boolean>;
Parent.html
<child [allowed]="allowed$ | async">
Child.ts
@Input() allowed : boolean
...
1
vote
2
answers
3k
views
Benefits of using toSignal instead of async pipe
For example, I need to fetch some data via http request and assign the received value somewhere in template. I would like to know which of the following solutions is better and whether there are ...
2
votes
0
answers
963
views
Display issue with an observable in Angular 17: the page loads indefinitely
I'm encountering an issue with Angular 17 where the use of an observable in my template seems to cause an indefinite loading of the page without displaying any errors in the browser console. This ...
2
votes
2
answers
4k
views
How to use async pipe with arrays in new Angular 17?
Suppose i have this promise in my component class.
testAsyncNumber = new Promise(
(res,rej)=>{
setTimeout(()=>{res([1,2,3,4,5])
},2000);
});
In view template i need to get data using ...
0
votes
1
answer
213
views
async pipe .find now allowed in Angular template?
Can anyone help me understand why this is not allowed in the Angular template?
<ng-container *ngIf="pt$ | async as pt">
<componenetOne[color]="pt.products.find(...
2
votes
1
answer
2k
views
Can't set signal from within async piped Observable
When I try setting a signal value from within an Observable that gets piped to async, I get the error:
Error: NG0600: Writing to signals is not allowed in a computed or an
effect by default. Use ...
0
votes
0
answers
139
views
When does the async pipe subscribe during an Angular unit test with Jasmine?
I have a navbar that displays a link if you're on the login page (which directs you to the next page) and a select drop-down that displays instead once you've navigated to the next page. A minimal ...