fix(ivy): support dynamic host attribute bindings (#29033)
In the @Component decorator, the 'host' field is an object which represents host bindings. The type of this field is complex, but is generally of the form {[key: string]: string}. Several different kinds of bindings can be specified, depending on the structure of the key. For example: ``` @Component({ host: {'[prop]': 'someExpr'} }) ``` will bind an expression 'someExpr' to the property 'prop'. This is known to be a property binding because of the square brackets in the binding key. If the binding key is a plain string (no brackets or parentheses), then it is known as an attribute binding. In this case, the right-hand side is not interpreted as an expression, but is instead a constant string. There is no actual requirement that at build time, these constant strings are known to the compiler, but this was previously enforced as a side effect of requiring the binding expressions for property and event bindings to be statically known (as they need to be parsed). This commit breaks that relationship and allows the attribute bindings to be dynamic. In the case that they are dynamic, the references to the dynamic values are reflected into the Ivy instructions for attribute bindings. PR Close #29033
This commit is contained in:

committed by
Andrew Kushnir

parent
a23a0bc3a4
commit
b50283ed67
@ -99,7 +99,7 @@ export {compileInjector, compileNgModule, R3InjectorMetadata, R3NgModuleMetadata
|
||||
export {compilePipeFromMetadata, R3PipeMetadata} from './render3/r3_pipe_compiler';
|
||||
export {makeBindingParser, parseTemplate} from './render3/view/template';
|
||||
export {R3Reference} from './render3/util';
|
||||
export {compileBaseDefFromMetadata, R3BaseRefMetaData, compileComponentFromMetadata, compileDirectiveFromMetadata, parseHostBindings, verifyHostBindings} from './render3/view/compiler';
|
||||
export {compileBaseDefFromMetadata, R3BaseRefMetaData, compileComponentFromMetadata, compileDirectiveFromMetadata, parseHostBindings, ParsedHostBindings, verifyHostBindings} from './render3/view/compiler';
|
||||
export {publishFacade} from './jit_compiler_facade';
|
||||
// This file only reexports content of the `src` folder. Keep it that way.
|
||||
|
||||
|
Reference in New Issue
Block a user