angular2-changedetection Questions

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...

21

Solved

I have a parent component (CategoryComponent), a child component (videoListComponent) and an ApiService. I have most of this working fine i.e. each component can access the json api and get its re...
Lorri asked 25/7, 2016 at 15:28

2

Solved

I have an Angular component that dynamically creates various other types of component inside itself. It binds its own properties to child component @Input properties via an OnChanges hook. This bi...
Exhibit asked 23/1, 2017 at 0:13

5

Solved

What is the difference between ChangeDetectorRef.markForCheck() and ChangeDetectorRef.detectChanges()? I only found information on SO as to the difference between NgZone.run(), but not between the...
Breadth asked 28/12, 2016 at 14:49

31

Solved

Please explain to me why I keep getting this error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Obviously, I only get it in dev mode, it doesn't happe...
Evaleen asked 12/4, 2017 at 16:59

11

Solved

I have a simple scenario, but just can't get it working! In my view I display some text in a box with limited height. The text is being fetched from the server, so the view updates when the text ...
Edwinaedwine asked 20/4, 2017 at 7:53

19

Solved

Question What is the most elegant way to get @ViewChild after corresponding element in template was shown? Below is an example. Also Plunker available. Component.template.html: <div id="lay...
Ossy asked 7/9, 2016 at 10:8

5

Solved

I have done some reading and investigation on this error, but not sure what the correct answer is for my situation. I understand that in dev mode, change detection runs twice, but I am reluctant to...

3

Solved

Trying to render the window size on window resize through a stream in an angular 2 component utilizing an async pipe: <h2>Size: {{size$ | async | json}}</h2> const windowSize$ = new B...
Toadstool asked 19/2, 2016 at 19:5

4

I have reproduced a simple stackblitz demonstrating the issue I have been having. The problem is that I have a parent component that passes a boolean to a child component. This boolean is an @Input...
Salleysalli asked 10/7, 2020 at 22:23

1

I'm trying to optimize the performance of code in angular application. I know that I can runOutsideAngular some code in order not to cause change detection on each code run or event. However, do ...
Mcmahan asked 1/4, 2020 at 11:17

6

Solved

So I have a header component that displays either the User's name or "Sign In" depending on whether they are logged in or not. I also have a Login component that does all of the business logic of l...
Vogler asked 23/3, 2017 at 21:25

2

Solved

I'm having an issue importing ChangeDetectorRef into one of my components. For reference, the family tree goes PComponent (parent) -> Options-Grid (child) -> FComponent (grandchild). This is the ...
Revolutionist asked 27/11, 2018 at 18:12

6

Solved

I would like to udpate my application view, triggered by events from service. One of my services injects the ChangeDetectorRef. Compilation works, but I am getting an error in the browser when the...
Near asked 15/9, 2016 at 13:5

1

Solved

I know that if I use a method call in a template it will get executed over and over (not ideal). I have solved that by using a combination of pure pipes and memoized methods. But I am also using re...
Littlest asked 26/5, 2020 at 23:44

3

I have read several answers, and I have tried many but I can't seem to get this to work. In my angular 6 app, I try to open a MatDialog but I receive this error: ERROR Error: ExpressionChanged...
Olwen asked 11/7, 2018 at 17:19

2

Solved

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, ...
Morvin asked 25/9, 2016 at 13:50

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...

2

Solved

I have next template of root component, that draws 9 tiles: <ul> <li *ngFor="let x of [0,1,2,3,4,5,6,7,8]"> <tile></tile> </li> </ul> and next tile compone...
Oneupmanship asked 14/6, 2017 at 13:44

4

Solved

Would it be a reasonable convention within an Angular-2 project to always use changeDetection: ChangeDetectionStrategy.OnPush within a component's decorator? Except when there are clear reasons...
Chacma asked 13/9, 2016 at 13:23

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...

1

Solved

This article mentions that Ivy opens a few possibilities for the future though. It should now be possible to run an application without zone.js, and to semi-manually handle change detection (a b...
Verret asked 10/11, 2019 at 1:17

6

Solved

How to force a component's re-rendering in Angular 2? For debug purposes working with Redux i'd like to force a component to re-render it's view, is that possible?
Permeability asked 30/1, 2016 at 18:22

1

Solved

I have an application that is listening for incoming data from an IPC Renderer Channel. Here is my setup: container that sends data to angular app (mainWindow): mainWindow.loadURL('http://www.mya...

7

Solved

In AngularJS you were able to specify watchers to observe changes in scope variables using the $watch function of the $scope. What is the equivalent of watching for variable changes (in, for exampl...
Stability asked 2/1, 2016 at 18:13

© 2022 - 2024 — McMap. All rights reserved.