159 questions
1
vote
1
answer
27
views
ngOnInit hasn't finished fetching data when ngAfterViewInit was ran
I have a code that looks like this. I expect that it will finish running fetchData function before calling ngAfterViewInit but its not. Do you have an idea what to check? Thank you!
@Component({
...
-1
votes
1
answer
52
views
Angular ngAfterContentChecked triggering non stop
I'm logging ngAfterContentChecked event and see this function triggering 10+ times per second. Is this normal? or when should this event be triggered? What could possibly cause this non stop retrigger?...
0
votes
0
answers
14
views
check if DOM element under *ngIf is already rendered
In my Angular 14 App I've got component with canvas in template.
Whole template is under *ngIf checking if data was emitted by Observable.
I need to create Chart using data from Observable and canvas ...
0
votes
0
answers
58
views
Get Angular Component height from Grid Layout
I'm trying to retrieve a component's height within itself (using ElementRef), which is located within a css grid layout. Background is the component renders images via picture-tag and depending on the ...
1
vote
1
answer
631
views
Angular Material <mat-select> Dropdown Not Interactive in Zoneless Angular 18 Until Browser Resize
Body:
I am encountering a peculiar issue with Angular Material's <mat-select> dropdown in my Angular 18.1.0 application. The dropdown does not appear or interact correctly on initial page load. ...
0
votes
1
answer
470
views
Angular 18: How to Ensure ngAfterViewInit Fires without zone.js in OnPush Components
Body:
I've recently removed zone.js from my Angular 18 project to optimize performance and am now facing an issue with the ngAfterViewInit lifecycle hook not firing consistently in a component with ...
1
vote
1
answer
45
views
Is the execution of fn in setTimeout(fn, 0) called from the constructor() ensured to happen after angular lifecycle hooks ngOnInit & ngAfterViewInit?
I have the following Angular2 'pseudo' code and I want to keep the user class as simple as possible:
// ###### LIB CLASSES ######
@Component()
export abstract class Parent {
abstract ...
0
votes
1
answer
39
views
change detection of variables declared in the extended class in angular 14 applicaiton
I'm looking for the best approach to detect changes in properties declared in extended classes in Angular. These changes are not detected by ngOnChanges because they're not inputs.
I've currently ...
0
votes
1
answer
431
views
I am stuck with BehaviorSubject in angular
I created centralized error handling service using BehaviorSubject in Angular v 17.It does not working in the expected way!
The problem areas are :
NotificationService --> the centralized error ...
0
votes
1
answer
90
views
Angular Lifecycle hooks?
Just wanted to know if I don't implement any lifecycle hooks explicitly does Angular framework call it implicitly?
For Eg: If I am not using @input in component does ngOnChanges will get triggered ...
0
votes
1
answer
49
views
HTML is rendered in Angular before binding to an observable. Lifecycle issue
I have a component that renders a grid of images bound to an Observable<Image[]> named sorted$.
<ng-container *ngFor="let image of sorted$ | async; index as i">
<img src=&...
-1
votes
1
answer
204
views
Why does the Angular constructor run before ngOnChanges even though it's not a part of the lifecycle hooks?
I've noticed that in Angular, the constructor of a component runs before the ngOnChanges hook, despite the constructor not being considered a part of the lifecycle hooks. Could someone explain why ...
0
votes
1
answer
98
views
Why to use @input @output over subject/services?
Generally while passing data from child to parent or parent to child we use @input and @output
what are the benefits @input and @output have over subject or services apart from it's the most organic ...
2
votes
0
answers
102
views
Programmatically hook into Angular lifecycle events
I am trying to report page load times to google analytics in my Angular 15 app. As far as I can tell, the only way to accurately measure the page load time is by using the AfterViewInit lifecycle hook....
1
vote
1
answer
532
views
is it possible to have currentValue = previousValue in ngOnChanges
As per my understanding, the ngOnChanges hook is only invoked when an input property undergoes a change. Therefore, it seems logical to say that within the ngOnChanges hook, changes.property?....