All Questions
276 questions
1
vote
1
answer
46
views
Angular ngOnChanges Not Updating Component Variables When @Input() Changes
I have an Angular component that receives an @Input() property from a parent component. The parent component fetches data asynchronously (from an API), and when the data is set, ngOnChanges should ...
1
vote
1
answer
105
views
Promise.all() never resolving
I have a function which should get some data asynchronously.
getPageEvents() {
const promises = this.calendarPage.days.map(day => {
return this.dataService.getEventsByDay(day)
....
1
vote
1
answer
71
views
Making subscriptions sync
I'm working on a project for my company and deeply respecting the NDA that I have signed I provide the following code snippet without any sensitive information, consider this code:
...
1
vote
3
answers
898
views
How manage asynchronous using [displayWith] in autocomplete?
I have an autocomplete in my angular reactive form.
I want to display myObject.name but use myObject.id as value.
When the form is prefilled with existing values, I need to get myObject.name base on ...
0
votes
1
answer
219
views
Marking a try / catch as async in TypeScript / JavaScript?
I am having problems getting the below code to go into the catch block on error,
try {
this.doSomething();
} catch (error) {
console.error(error);
}
if "doSomething" returns a ...
1
vote
1
answer
114
views
Handling async data with rxjs
I have a loginComponent that receives an email and a password and makes an http request to get the user data. After that, I want to use that user data in other components using a service.
login ...
0
votes
1
answer
2k
views
How to update an observable when it has been converted to Signal if new data has been emitted?
I am trying to utilse some of Angular's new reactivity with Signal. I am following this workflow, and converting one of my observables into a signal, this is then being read and displayed on my screen....
-1
votes
1
answer
58
views
How to remove chaining in this code using behavior subjects?
How can we refactor the following code to remove the chaining using behaviorsubjects, so that the failure of one function call does not affect the UI which uses the data from the other function calls?
...
0
votes
0
answers
115
views
Google Charts with *ngIf in Angular
I am building an Angular app where I am using google charts. Faced some issue which seems to be related to async
My HTML code is:
<i class='bx bx-line-chart chart-icon' (click)="changeGraph('...
0
votes
1
answer
595
views
Cannot read properties of undefined (reading 'nativeElement') with writeValue angular function
I'm working on an angular application, which has an architecture with pre-defined classes I need to follow. I'm showing a list of addresses and I'm adding CRUD functionality.
The problem I'm ...
0
votes
1
answer
61
views
How to decide if call an http request and execute the subscribe body anyways
I have some code like this:
this.service.callAPI().subscribe(
data => {
callFunction();
},
error => {console.log("Mi mistake")}
);
But I would ...
1
vote
3
answers
964
views
How to do things after an observable gets its data in Angular
I am using an observable to retrieve data from an http like:
handleError(error:any) {
...
}
getData() {
return this._api_service.http.get<JSON>(this._url).pipe(retry(1), catchError(this....
0
votes
1
answer
279
views
Modify the rxjs Observer to make another API request and return the same observer
I am making a HTTP request in Angular service which is returning the observable of this kind :
var response = of({
status: "success",
rings: [
{ pIds: [1, 2], pNames: [] },
{ ...
0
votes
1
answer
2k
views
ERROR TypeError: Cannot read properties of undefined (reading 'file')
I make this component with custom validate and declare variable in top of component and assigning value to , but when i use this variable inside custom validation it return this error if change value ...
2
votes
1
answer
742
views
Jasmine: how to test a Promise.then block?
I want to test a scenario where I have to call a function (from a service which is private readonly) in which there is an async call, then some variables are getting updated etc.
myFunction(param) {
...