fix(language-service): Resolve template variable in nested ngFor (#33676)
This commit fixes a bug whereby template variables in nested scope are not resolved properly and instead are simply typed as `any`. PR closes https://github.com/angular/vscode-ng-language-service/issues/144 PR Close #33676
This commit is contained in:

committed by
Kara Erickson

parent
72796b98b1
commit
66157436f8
@ -283,6 +283,20 @@ describe('completions', () => {
|
||||
const completions = ngLS.getCompletionsAt(PARSING_CASES, marker.start);
|
||||
expectContain(completions, CompletionKind.PROPERTY, ['name', 'age', 'street']);
|
||||
});
|
||||
|
||||
it('should be able to resolve variable in nested loop', () => {
|
||||
mockHost.override(TEST_TEMPLATE, `
|
||||
<div *ngFor="let leagueMembers of league">
|
||||
<div *ngFor="let member of leagueMembers">
|
||||
{{member.~{position}}}
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
const marker = mockHost.getLocationMarkerFor(TEST_TEMPLATE, 'position');
|
||||
const completions = ngLS.getCompletionsAt(TEST_TEMPLATE, marker.start);
|
||||
// member variable of type Hero has properties 'id' and 'name'.
|
||||
expectContain(completions, CompletionKind.PROPERTY, ['id', 'name']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('data binding', () => {
|
||||
|
Reference in New Issue
Block a user