Questions tagged [angular2-changedetection]
473 questions
5
votes
1 answer
ngOnInit is not triggering after disabling zone.js in Angular 5
I recently upgraded my Angular app from 4.3 to 5.0 and trying to play around some of the new features in it. One of them is removing dependancy from zone.js.
main.ts:
platformBrowserDynamic().bootstrapModule(AppModule, {
ngZone:…

Saurabh Palatkar
- 3,242
- 9
- 48
- 107
5
votes
3 answers
How to debug "Expression Changed After It Has Been Checked" Error?
This is a notorious error, which has a quite a "following" among developers, however it is also known to be quite tricky to debug. The log like this
PersonalSituationComponent.html:3 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError:…

pop
- 3,464
- 3
- 26
- 43
5
votes
1 answer
ExpressionChangedAfterItHasBeenCheckedError in two-way Angular binding
Here's an example:
@Component({
selector: 'my-app',
template: `
`,
})
export class App {
foo;
}
@Component({
selector: 'bpp',
template: `
{{ foo }}
…

Estus Flask
- 206,104
- 70
- 425
- 565
5
votes
1 answer
Angular 2 - Prevent Change Detection
I have a setInterval() function in a component class that fires off every 1/10 of a second. All it does is update a d3 graph and does not touch any angular bindings.
By default setInterval() triggers the change detection in angular from the root…

Nik
- 7,086
- 6
- 36
- 52
5
votes
2 answers
Angular 2 Chrome DOM rendering problems
Our team (not only my computer) has a wierd rendering issue for Angular 2, that only happens in Chrome.
Namely, when navigating the app or refreshing in mid app, many of the items in DOM are invisible. EG. paragraphs and headers that have text in…

Karl Johan Vallner
- 3,980
- 4
- 35
- 46
5
votes
2 answers
Angular2 template expression called twice for each component on change-detection
Pretty standard situation.
There is one parent component .
Inside its template with *ngFor generated 20 child components .
Child component styles set with [ngStyle] directive and template expression that calls function…

Alex Kalmikov
- 1,865
- 19
- 20
5
votes
1 answer
Using ipcRenderer in angular 2; trigger change detection
I am building an electron app with angular 2 in the renderer process. My main process talks to a socket server. Whenever the user is connected to this server or disconnected, I wish to show the user's status in the view.
For this, I use electron's…

Willem van Gerven
- 1,407
- 1
- 17
- 24
5
votes
2 answers
Angular 2 forms + OnPush
I am writing an angular 2 application where I try to use ChangeDetectionStrategy.OnPush everywhere, for performance reasons. I have a complex component that needs OnPush in order to work smoothly, which contains another component that is displaying…

highwaychile
- 755
- 1
- 6
- 18
5
votes
1 answer
Using observables in Dart for Angular2 change detection
In my Angular2 app, written in Dart, I have several services that track data shared between components that don't necessarily have any particular relation in the view. I need updates initiated by any component to be reflected in every component's…

Douglas
- 5,017
- 1
- 14
- 28
4
votes
1 answer
How does Angular Signals affect RXJS Observables and what happens to change detection in this case
I am trying to switch to Signals in my Angular App and i currently have issues finding good practices and i also experienced (at least for me) unexpected behaviour.
This is a snippet of my code consisting of a userService and two Components
export…

Tilman Adam
- 41
- 3
4
votes
2 answers
Angular: Setting an emptied string to a default value does not update the bound text field properly if the field previously had the default value
I'm using a SET method to set my bound value to 'DEFAULT' if we ever attempt to set it to an empty string. The bound text input behaves properly in every scenario, EXCEPT if the text field already says 'DEFAULT' and I "select all + delete" that…

Leviathan3
- 69
- 8
4
votes
0 answers
Angular OnPush change detection strategy performance
My understanding of angular change detection strategy from various articles and stackoverflow posts:
The change detection process includes:
Updating inputs to children of a component.
Run change detection for embedded views.
Call ngOnChanges,…

saivishnu tammineni
- 1,092
- 7
- 14
4
votes
0 answers
Why is execEmbeddedViewsAction called a few times?
I have a virtual scroll in my app that emits a slice of a big array and then I iterate through those items with *ngFor to display a list of li items that inside have quite a lot of code. Based on the current element from the array it decides which…

mmrzk
- 83
- 7
4
votes
0 answers
Angular Ivy without zones: what is the most convenient way to trigger change detection?
I would like to get rid of the zones in my app. I am considering several options for triggering change detection:
Manual triggering change detection by invoking this.changeDetectorRef.detectChanges() / ΘmarkDirty(this) in a component on every…

Yevhen Stativka
- 41
- 1
- 2
4
votes
1 answer
Why do i need to add markForCheck() to trigger change detection in Angular?
I don't quite understand why i need to add markForCheck() to the code below to make the changes visible. Why is my @Input() not triggering change detection?
I am refactoring my project to OnPush. These 2 components both have OnPush enabled. As i…

Martijn van den Bergh
- 1,434
- 1
- 20
- 40