160 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
5
votes
1
answer
126
views
Angular doesn't update value using ngOnInit()
I'm consuming an API with Angular 21. I have a service that sends a http petition and returns it's response. However, I'm calling the service on my ngOnInit; when I start the app, it displays the ...
3
votes
1
answer
74
views
Why is ngDoCheck() called again after ngAfterContentChecked() for both the AppComponent and ChildComponent during App startup?
I am using Angular 19. I have created a simple project to better understand the lifecycle hooks. I noticed that ngDoCheck() is called again after ngAfterContentChecked() for both the AppComponent and ...
1
vote
1
answer
34
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
124
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
77
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
744
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
549
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
54
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
54
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
473
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
99
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
55
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
253
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
123
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
118
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....