using setTimeout to reload child component instead of ngOnChanges inside it

Maybe for someone, this question will sound a little dumb. For me, is an unexpected behavior because I reuse a child component and I found that the data inside it are not updated when I change the source from parent. Because I don’t want to implement ngOnChanges there (I try to avoid using it how […]

By AlleXyS
Published
Categorized as angular, javascript, settimeout, typescript Tagged , , ,

chartjs how to disable value label above bar lines

Somethimes I get NaN % as bar values from my chart (totally random). I want to avoid it, but can’t find a solution to hide these errors. To make it dissapear, I need to refresh the page. This is happening for all the charts from app, not only for this. I’m pretty sure I need […]

By AlleXyS
Published
Categorized as angular, chart.js Tagged ,

distinctUntilChanged not working for same value as previous

Something strange happening here. I have a form with 3 fields: a string and two objects. The both objects get values from mat-select. Here, if I select again the current value, will not be emitted any event. For the string, is another situation (named country) The country field is a value get from one of […]

By AlleXyS
Published
Categorized as angular, formgroups, forms, rxjs, typescript Tagged , , , ,

Waiting to render another elements

I attached an image to can exemplify the problem. I have 4 elements in page: a table (which is an header with some data) a chart a table under the chart (which use chart labels as table header) a footer Because first table have only 2 rows (and is static), tableChart also is static (with […]

By AlleXyS
Published
Categorized as angular, css, html, javascript, typescript Tagged , , , ,

Observable can’t pass in finally from err state

Is not first time when I encounter this problem. Because I want to display some data on web page, even if the http request failed, I have some logique inside the err state. To not duplicate code in subscribe and err, I use to write it inside complete/finally state. this.loadingResults = true; this.service.get().subscribe(data => { […]

By AlleXyS
Published
Categorized as angular, observable, rxjs, subscribe, typescript Tagged , , , ,

Convert TZ date received from Angular in Scala backend

I’m sick of datetime problems between 2 languages. Angular send dates only in TZ format (2021-09-06T11:25:39.000Z), but my Scala backend is not capable to use it in SimpleDateFormat. def formattedDate(input: String, format: String = "yyyy-MM-dd HH:mm:ss"): String = new SimpleDateFormat(format).format(new SimpleDateFormat(format).parse(input)) Error: Caused by: java.text.ParseException: Unparseable date: "2021-09-06T11:25:39.000Z" How can I solve this? thx Source: […]

By AlleXyS
Published
Categorized as angular, datetime, scala, typescript Tagged , , ,

All route query params are strings – typescript can’t know to auto convert to required type

This question is more a curiosity of mine. I have an component from where I redirect to another, using an query parameter: comp A: this.router.navigate([‘dashboards’], {queryParams: {id: this.id}}); Even if my id have number type, I know the url is a string and the param will be converted automatically to string resulting in domain.com/dashboards?id=23 my […]

By AlleXyS
Published
Categorized as angular, numbers, string, types, typescript Tagged , , , ,

Adding optional change event on html element and js function

I have an Angular popup component which is used for multiple types. For types A and B I have an "action" section in footer, which is used to get results and close the popup. For type C, I want to close the popup when a checkbox is selected (so, here I need to use change […]

How to fire NGRX Selector foreach children component independently

I have a component which have a role as a widget in a dashboard. So, I’ll use an *ngFor to render as many widgets as the dashboard have. The WidgetComponent is only one and receive a part of it’s data by @Input() from the parent. parent <app-widget *ngFor="let widget of widgets" [widget]="widget"> </app-widget> In the […]

By AlleXyS
Published
Categorized as angular, javascript, ngrx, selector, typescript Tagged , , , ,

Identify of which observable the error belongs for a list of observables

const obs1$ = this.service.getAllSources(); const obs2$ = this.service.getWidgetById(1); combineLatest([obs1$, obs2$]) .subscribe(pair => { const sources = pair[0]; const widget = pair[1]; // do stuff }, err => { // err can be from first or second observable, but which? if (err.status === 404) { // here I need to know for which observable the error […]

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq