New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ivy): match directives on bindings and element outputs #25614
fix(ivy): match directives on bindings and element outputs #25614
Conversation
904b664
to
ecaf96e
Compare
You can preview ecaf96e at https://pr25614-ecaf96e.ngbuilds.io/. |
ecaf96e
to
e793079
Compare
You can preview e793079 at https://pr25614-e793079.ngbuilds.io/. |
Regarding the CircleCI job failing - I can reproduce the same issue on master. Did a quick error analysis and it fails since component def seem not to be generated / component not patched. Happens in the AOT mode only, JIT is fine. Not sure how to troubleshoot those, though... |
const attrsExprs: o.Expression[] = []; | ||
template.attributes.forEach( | ||
(a: t.TextAttribute) => { attrsExprs.push(asLiteral(a.name), asLiteral(a.value)); }); | ||
attrsExprs.push(...this.prepareSelectOnlyAttrs(template.inputs, template.outputs)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI spreading generates quite a bit of boilerplate in ES5 target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of boilerplate? Isn't it just a.push.apply(a, b)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plus it should be mostly run on Node so ES2015+ target...
@@ -82,7 +82,8 @@ export function compileComponent(type: Type<any>, metadata: Component): void { | |||
|
|||
// If component compilation is async, then the @NgModule annotation which declares the | |||
// component may execute and set an ngSelectorScope property on the component type. This | |||
// allows the component to patch itself with directiveDefs from the module after it finishes | |||
// allows the component to patch itself with directiveDefs from the module after it | |||
// finishes | |||
// compiling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compiling
could now be moved to above line.
@@ -49,6 +49,7 @@ export const angularCoreEnv: {[name: string]: Function} = { | |||
'ɵnamespaceHTML': r3.namespaceHTML, | |||
'ɵnamespaceMathML': r3.namespaceMathML, | |||
'ɵnamespaceSVG': r3.namespaceSVG, | |||
'ɵamSelectOnly': r3.AttributeMarker.SelectOnly, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd also need to export ɵamSelectOnly
for AOT compilations. FYI, styling constants are inlined by the compiler currently.
initialStyleDeclarations.push(o.literal(core.InitialStylingFlags.VALUES_MODE)); |
const $e0_styling$ = ["opacity","width","height",${InitialStylingFlags.VALUES_MODE},"opacity","1"]; |
I think it would be better to inline it everywhere, or nowhere at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh, I think in-lining it is a better option. Will change this, thnx!
e793079
to
5e58983
Compare
You can preview 5e58983 at https://pr25614-5e58983.ngbuilds.io/. |
5e58983
to
e748536
Compare
You can preview e748536 at https://pr25614-e748536.ngbuilds.io/. |
e748536
to
314dd13
Compare
You can preview 314dd13 at https://pr25614-314dd13.ngbuilds.io/. |
|
314dd13
to
c154631
Compare
You can preview c154631 at https://pr25614-c154631.ngbuilds.io/. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Closes #23560
This PR makes sure that directives are matching on:
<div [myDirective]="exp">
/<ng-template [myDirective]="exp">
<div (myDirective)="doSth()">
To do the above we need to do proper directives matching on the compiler side (see ) and generate attributes for matching purposes in the runtime (see).
Matching on
<ng-template>
outputs (ex.:<ng-template (myDirective)="doSth()">
) will be done in a follow-up PR as it requires(?) re-working of thelistener(...)
instruction.