You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, it is working as expected when ivy isn't enabled.
Description
the variable name used for the variable in the ngFor loop can no longer be the same as the variable you're using within the ngFor from the component.
馃敩 Minimal Reproduction
using @angular/cli@8.0.0-rc.4 create a new project.
Add a property to the AppComponent someClass: any;
Add the following to the html template of the component.
<div*ngFor='let someClass of someClass.children' ></div>
enable ivy
run ng build --aot
It doesn't matter the type of someClass. Let it be any.
It appears that ivy can't differentiate between the someClass in let someClass and someClass in someClass.children.
The code won't compile unless you change the name to something different.
Like this.
<div*ngFor='let someClass2 of someClass.children' ></div>
ERROR in : Error: Could not resolve [object Object] / undefined
at Scope.resolve (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:549:23)
at tcbResolve (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:827:34)
at C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:755:74
at astToTypescript (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:47:24)
at astToTypescript (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:59:28)
at Object.astToTypescript (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:54:20)
at tcbExpression (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:755:29)
at processAttribute (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:802:28)
at Array.forEach ()
at tcbGetInputBindingExpressions (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:792:30)
at TcbDirectiveOp.execute (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:300:28)
at Scope.executeOp (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:622:26)
at Scope.render (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:561:22)
at Object.generateTypeCheckBlock (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:43:37)
at TypeCheckFile.addTypeCheckBlock (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_file.js:47:41)
at TypeCheckContext.addTemplate (C:\Users\edavidson\src\temp\MatSortUpdateIssue\MatSortUpdateIssue\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\context.js:98:36)
馃悶 bug report
Affected Package
The issue is caused by the new Ivy renderer.Is this a regression?
Yes, it is working as expected when ivy isn't enabled.Description
the variable name used for the variable in the ngFor loop can no longer be the same as the variable you're using within the ngFor from the component.
馃敩 Minimal Reproduction
using @angular/cli@8.0.0-rc.4 create a new project.
Add a property to the AppComponent
someClass: any;
Add the following to the html template of the component.
enable ivy
run
ng build --aot
It doesn't matter the type of someClass. Let it be any.
It appears that ivy can't differentiate between the
someClass
inlet someClass
andsomeClass
insomeClass.children
.The code won't compile unless you change the name to something different.
Like this.
I'm not sure how to get stack blitz to run with the --aot flag. So here's a git repo with the same code. https://github.com/e-davidson/angular-ivy-issue
馃敟 Exception or Error
馃實 Your Environment
Angular Version:
The text was updated successfully, but these errors were encountered: