Questions tagged [angular2-changedetection]

473 questions
3
votes
2 answers

Optimizing change detection with Angularfire's Firestore Observable

After experiencing some in-browser sluggishness, I'm trying to optimize change detection in my Angularfire-powered app. I read this SO answer and tried to model my list code similarly. my container class:
Brian A Bird
  • 378
  • 2
  • 18
3
votes
2 answers

Angular2 Change Detection Infinite Loop

We have a simple component with an input property as such: On the component where we use app-example we have: get exampleInputData$(): any { var subject = new Subject(); …
user351711
  • 3,171
  • 5
  • 39
  • 74
3
votes
1 answer

Detecting when a value changes in a @ViewChild()

I have been provided with a component which is simply a +/- counter. I can get a reference to the value I need from this component like this: {{ adultCount.val…
serlingpa
  • 12,024
  • 24
  • 80
  • 130
3
votes
0 answers

Issue when model changes within AJAX call in ngx-admin

I downloaded the latest build of ngx-admin (https://github.com/akveo/ngx-admin), and served it up locally. In the ./@core/data/users.service.ts file I have added the following method getHeroes (): Observable { return…
alex
  • 444
  • 1
  • 5
  • 17
3
votes
0 answers

OnPush Change Detection with @Input FormGroups

Imagine the following component hierarchy in an Angular 2 application. app.component └── node.component ├── header.component ├── body.component └── footer.component The app will render a tree of nodes. There is a single 'root' node held…
Jack
  • 10,313
  • 15
  • 75
  • 118
3
votes
1 answer

Angular OnPush Component, does DOM event force Angular to call markForCheck() automatically?

I'm reading about Zone.JS and the Angular change detection process, in the code source, Zone.JS notifies Angular about changes and run the verification in the first component from top to bottom by propagating the check into all components, but in my…
3
votes
1 answer

Change detection not working after using native JS

I have an Angular 2 app that builds a tree using mermaidJS, which is a JS (not TS) framework. To bind clicks on this tree to Angular events, in my ngOnInit() method I create window functions, like this : window['myFunctionToBeCalledFromTheTree'] =…
user4676340
3
votes
3 answers

Angular change detection on @Input object

I kind of understand how change detection works in Angular 2 but I'm really struggling to transfer/change my AngularJS methods over to NG2 regarding change detection. Imagine I have a component that takes a single @Input() anObject and has a single…
Chris Gilbert
  • 348
  • 5
  • 12
3
votes
3 answers

Angular ChangeDetection NgIf

So i am trying to better understand Angulars ChangeDetection and stumbled into a problem: https://plnkr.co/edit/M8d6FhmDhGWIvSWNVpPm?p=preview This Plunkr is a simplified version of my applications code and basically has a parent and a child…
Wagner Michael
  • 2,172
  • 1
  • 15
  • 29
3
votes
2 answers

How do I create a disabled form having child components?

For the life of me, it seems like I should be able to create a disabled FormArray. I'm trying to build a view-only parent form (FormArray) with 1-n subarrays (also FormArray). I pass the subarrays down to the child components to initialize their…
stealththeninja
  • 3,576
  • 1
  • 26
  • 44
3
votes
1 answer

Angular2 OnPush change detection and ngFor

I have a parent component that displays a list of child components using ngFor. I noticed that performance gets really bad with increasing number of children so I have changed both to OnPush change detection strategy. That helped a lot, but there…
Zyga
  • 2,367
  • 3
  • 22
  • 32
3
votes
1 answer

Angular 2 change detector

I´m trying to understand the change detector mechanism in Angular 2 applications. I think I made some progress reading several posts :) but not a lot. For what I understand the situation is like this: When the component is not using the OnPush…
yagopv
  • 317
  • 4
  • 9
3
votes
1 answer

How can I prevent Firebase from repeatedly triggering change detection in Angular 2?

Firebase uses a lot of internal asynchronous calls that trigger change detection because of Angular/Zone monkey-patching websockets and setInterval etc. Even when I'm not interacting with my app, I see a cascade of change detection happening all the…
3
votes
1 answer

Angular2 trigger function when observable property changes

I use a workingData service that holds data that permeates my application. It returns an observable to the Mock workingData object. @Injectable() export class WorkingDataService { getWorkingData(): Observable { return…
3
votes
1 answer

Ionic modal change detection

I have a component using an Ionic modal to modify the album variable. addMedias() { let self = this; let profileModal = self.modalCtrl.create(AlbumAddPage, { album: self.album }); profileModal.onDidDismiss(data => { …