some ViewContainerRef properties are missed in angular 9?
See original GitHub issue🐞 bug report
embeddedViews
prperty not available in angular 9 viewcontainerRef
property and there is no alternate property also available
Is this a regression?
yes
Description
This is my script condition in my source level which is working fine in angular 7 and 8,
if (this.isNgTemplate()) {
let items = this.listViewInstance.element.querySelectorAll('.' + classNames.listItem);
for (let index = 0; index < items.length; index++) {
items[index].context = this.listViewInstance.viewContainerRef._embeddedViews[index].context;
}
But throws script error in angular 9, if i disbale ivy working fine.
Validation details
I have validated and find root cause of my issue. in angular 7, viewcontainerRef
property looks like below which has embeddedViews
property so my script works fine.
But in angular 9, there is no embeddedViews
property, viewcontainer
property looks like beloe:
🔬 Minimal Reproduction
Working sample
-
Angular 7 sample - Angular 7-ListView.zip
-
download above sample
-
Give
npm i
and then giveng serve
-
you will see no script error in console
issue reproducing sample
-
angular 9 sample Angular9-Virtualization template.zip
-
do same steps - you will see console error
🌍 Your Environment
Angular Version:
"@angular/animations": "~9.0.0",
"@angular/common": "~9.0.0",
"@angular/compiler": "~9.0.0",
"@angular/core": "~9.0.0",
"@angular/forms": "~9.0.0",
"@angular/platform-browser": "~9.0.0",
"@angular/platform-browser-dynamic": "~9.0.0",
"@angular/router": "~9.0.0",
"@angular-devkit/build-angular": "~0.900.1",
"@angular/cli": "~9.0.1",
"@angular/compiler-cli": "~9.0.0",
"@angular/language-service": "~9.0.0",
Anything else relevant?
when disale IVY
, there is now console error.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (4 by maintainers)
Top GitHub Comments
Thanks @pkozlowski-opensource , this comment solve my issue but i haven’t check properly at my end. Due cache problem this takes time
@pkozlowski-opensource , please check below which will help you to find cause or something?
repro stesp
download sample - Angular9-Virtualization template.zip
Giev
npm i
and thenng serve
you will see console error in browser
reason
In my source, i have used
embededview
api to get component view and update my component native element template property.details
in below, i am updating
template
values to my created element usingembededview
apiafter updating template value from embedded views, my element items looks like below
above template values has been taken from
this.listViewInstance.viewContainerRef._embeddedViews
But in angular9, i didn’t get any reference so that i am not able to update my element template values