feat(ivy): Bind to right context in nested template statmentes (#23168)
Given ``` <div *ngFor=”…” (click)=“doSomething()”> ``` Before `doSomething` would execute on the inner template context, which is incorrect. The correct behavior is to execute on the top level context of the component. PR Close #23168
This commit is contained in:
@ -641,7 +641,7 @@ class TemplateDefinitionBuilder implements TemplateAstVisitor, LocalResolver {
|
||||
element.outputs.forEach((outputAst: BoundEventAst) => {
|
||||
const functionName = `${this.templateName}_${element.name}_${outputAst.name}_listener`;
|
||||
const bindingExpr = convertActionBinding(
|
||||
this, implicit, outputAst.handler, 'b', () => error('Unexpected interpolation'));
|
||||
this, o.variable('ctx'), outputAst.handler, 'b', () => error('Unexpected interpolation'));
|
||||
const handler = o.fn(
|
||||
[new o.FnParam('$event', o.DYNAMIC_TYPE)],
|
||||
[...bindingExpr.stmts, new o.ReturnStatement(bindingExpr.allowDefault)], o.INFERRED_TYPE,
|
||||
|
Reference in New Issue
Block a user