fix(ivy): fix bug with banana-in-a-box expressions in nested templates (#25321)
Inside of a nested template, an attempt to generate code for a banana- in-a-box expression would cause a crash in the _AstToIrVisitor, as it was not handling the case where a write would be generated to a local variable. This change supports such a mode of operation. PR Close #25321
This commit is contained in:

committed by
Kara Erickson

parent
02e201ab1a
commit
fefc860f35
@ -640,4 +640,21 @@ describe('ngtsc behavioral tests', () => {
|
||||
expect(emptyFactory).toContain(`import * as i0 from '@angular/core';`);
|
||||
expect(emptyFactory).toContain(`export var ɵNonEmptyModule = true;`);
|
||||
});
|
||||
|
||||
it('should compile a banana-in-a-box inside of a template', () => {
|
||||
writeConfig();
|
||||
write('test.ts', `
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
template: '<div *tmpl [(bananaInABox)]="prop"></div>',
|
||||
selector: 'test'
|
||||
})
|
||||
class TestCmp {}
|
||||
`);
|
||||
|
||||
const exitCode = main(['-p', basePath], errorSpy);
|
||||
expect(errorSpy).not.toHaveBeenCalled();
|
||||
expect(exitCode).toBe(0);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user