angular-changedetection Questions

2

Solved

I'll start this question from notion that I've seen a similar question on StackOverflow, but that question had only answer for the difference. What I'm asking is what should I use depending on sit...

5

Solved

I have one parent and one child component. If the child component updates its value internally I am unable to update value back from Parent. See the example in this Stackblitz: https://stackblitz.c...
Ruddy asked 2/6, 2020 at 21:56

3

I'm trying to migrate an app to using ChangeDetectionStrategy.OnPush. However, I'm running into a bit of a blocker trying to work with some reactive forms. I've got a reusable control that shows v...

2

Solved

To put my problem simply, I have an element in component's template. This element has an ngIf condition and a (click) handler. It is not rendered from the very beginning, because the ngIf condition...
Thing asked 10/5, 2020 at 13:30

7

Solved

Why is the view not being updated when a variable changes within a subscribe? I have this code: example.component.ts testVariable: string; ngOnInit() { this.testVariable = 'foo'; this.someSe...
Exquisite asked 24/5, 2018 at 22:45

3

Solved

How to set the default change detection strategy to OnPush? Can it be set globally somehow? I want to avoid having to adding this line to every component @Component({ ... changeDetection: Chang...
Fitzsimmons asked 14/6, 2016 at 21:0

3

Using Angular 10 There are many questions on SO that are similar to this, but I have yet to find one that answers my situation. I'm hoping someone can guide me. I'm using a third party library to d...
Honkytonk asked 17/12, 2021 at 6:2

1

It seems using getters inside templates causes Angular change detection to go into a loop (getter gets called hundreds of times). After reading up a ton on similar issues out there I cannot seem to...

5

Solved

I have created a simple example to demonstrate a weird issue I'm facing. Stackblitz - https://stackblitz.com/edit/angular-change-detection-form-group I have three components and here are they: ...
Cogen asked 5/12, 2018 at 20:52

1

Solved

Following this good article on angular's change detection, I wanted to debug the checkAndUpdateView function. However, it is never triggered. What am I missing? I tried with the latest Chrome and ...
Novelistic asked 1/10, 2020 at 14:41

2

Solved

I went through quite a lot of SO posts trying to find a solution to this one, the only one I found had a hack implementation. I have an observable taken from the ngrx store which I subscribe too: ...
Light asked 13/6, 2019 at 13:59

2

Solved

Everywhere it is said that markForCheck just marks current component view and all parent components (up to the root one) as dirty. So next time DetectChanges executes it will update the view. From...
Theocracy asked 25/5, 2020 at 14:59

1

Solved

I'm having a problem with an Angular 6 application: The problem Let's say I have 2 components: parent and child. the child has 2 inputs. While 1 input changes, inside the ngOnChanges() the child...

0

I'm writing a test for an Angular pipe. The pipe has an injected ChangeDetectorRef and this.changeDetectorRef.markForCheck() is been called in a function. However, when I write and run my Unit tes...
Sydney asked 4/12, 2019 at 12:52

2

Should I always use ChangeDetectionStrategy.OnPush in my components? I always hear how OnPush is absolutely amazing, and solves so many issues, speeds up the Angular app, and even get rid of NgZon...

2

Solved

Given a list of items (think of it as a chat with multiple messages), I'd like to use moment.js to display the relative time (e.g. since creation) for each item. Each item has its own component an...
Miserere asked 1/7, 2018 at 8:19

2

I am implementing a filtering operation on an array in Angular2. A pure pipe is not triggering when an element change in the array. Thus, I have to use either an impure pipe or make the filtering w...

1

Solved

Minimal Stackblitz Example https://stackblitz.com/edit/angular-mqqvz1 In an Angular 7 App, I have created a simple component with an <input> field. When I change the input-value with the k...

1

Solved

I'd like to make some operation from parent component on child component after child component has been initialised. Parent: export class ParentComponent implements AfterViewInit { @ViewChild('c...
Coppersmith asked 7/1, 2019 at 9:56

1

Solved

We have a number of components in our Angular application that need to regularly display new values every second that are unique to each component (countdowns, timestamps, elapsed time, etc). The m...
Halfsole asked 4/12, 2018 at 17:4

1

Solved

My app component is having a subscribe on a store select. I set ChangeDetectionStrategy to OnPush. I have been reading about how this works; object reference needs to be updated to trigger a change...
Cycloplegia asked 22/7, 2018 at 11:55

1

Solved

I'm pretty much informed of how Angular's Change Detection works, as well as how we can use OnChanges hook for detecting @Input properties changes, and also a subscribing to ngModel valueChanges in...
Rodolphe asked 9/4, 2018 at 6:59

1

From these two posts: The mechanics of DOM updates in Angular Angular 2 Performance: Is it better to bind with a data member than a function? I understand how the DOM updated when the 'Change ...
Secrest asked 16/3, 2018 at 12:25

1

Solved

I've been reading some articles about change detection strategy, but i have some doubts about which are the cases where makes sense to use on push strategy. Basically my doubt is about when we have...
Razorback asked 28/2, 2018 at 23:28
1

© 2022 - 2025 — McMap. All rights reserved.