question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow read of ChangeDetectorRef in queries

See original GitHub issue

🐞 bug report

Affected Package

The issue is caused by package @angular/core

Is this a regression?

I don't think so, tested on Angular 7 and 8

Description

Through `read` option of `ViewChild` we are able to retrieve services from Injector, for example if we add some service to our component's providers, we can read it. We can also read `ElementRef`, for example. However, we cannot retrieve `ChangeDetecotrRef`. We are getting undefined.

πŸ”¬ Minimal Reproduction

https://stackblitz.com/edit/angular-read-cdr

🌍 Your Environment

Angular Version:

8

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:41
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
waterpleacommented, Jun 4, 2021

Bumped stackblitz versions and it’s still an issue with Angular 12. @pkozlowski-opensource any reason for the special treatment of CDR here? I don’t see this issue passing voting in 20 days 😦

0reactions
angular-robot[bot]commented, Jun 4, 2021

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular’s feature request process in our documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Everything you need to know about change detection in Angular
Here we review in great details all operations performed by Angular during change detection, explore implications and take a close look at change...
Read more >
Cannot read property 'detectChanges' of undefined - Stack ...
I am receiving the following error with ChangeDetectorRef.
Read more >
Angular 14 Change Detection Tutorial with Example
In this Angular tutorial, We are going to see how does Change Detection strategy work in a simple and easy way. The ChangeDetectorRef...
Read more >
ComponentRef.changeDetectorRef is not the same instance ...
I'm submitting a... [x] Feature Current behavior When you create a Dynamic Component via ViewContainerRef#createComponent the returnedΒ ...
Read more >
ChangeDetectorRef - Angular
Detach change detector to limit how often check occurslink. The following example defines a component with a large list of read-only data that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found