Dear Support Teams,
Does metronic effect changes detection in angular. Coz i found out, when loading/ initiate a page my app does not detect any changes. Unless i type something on input, then it will detect a changes.
My scenario is, when loading a page, i will call an api to list all the result. At first, there is no result displayed in my table. But after i type in any input field , then the result will be shown.
Another thing is, does metronic template come with calendar that can be used with angular. or do i need to install third party library for that eg. ngx-tempusdominus-bootstrap.
Thanks for response
Hi Cheyo,
In order to ensure that changes are detected and applied to your UI, you may need to manually trigger change detection in your component.
One way to do this is by injecting the ChangeDetectorRef service into your component, and calling its detectChanges() method after your API call has completed and you have received the results. This will tell Angular to check for any changes and update your UI accordingly.
For example, you could add the following code to your component:
import { Component, OnInit, ChangeDetectorRef } from "@angular/core";
@Component({
// ...
})
export class MyComponent implements OnInit {
results: any[];
constructor(private cdr: ChangeDetectorRef) {}
ngOnInit() {
// Call your API to get the results
this.apiService.getResults().subscribe((results) => {
this.results = results;
// Manually trigger change detection to update the UI
this.cdr.detectChanges();
});
}
}