MCPcopy Create free account
hub / github.com/angular/angular / ingestHostBinding

Function ingestHostBinding

packages/compiler/src/template/pipeline/src/ingest.ts:104–149  ·  view source on GitHub ↗
(
  input: HostBindingInput,
  bindingParser: BindingParser,
  constantPool: ConstantPool,
)

Source from the content-addressed store, hash-verified

102 * representation.
103 */
104export function ingestHostBinding(
105 input: HostBindingInput,
106 bindingParser: BindingParser,
107 constantPool: ConstantPool,
108): HostBindingCompilationJob {
109 const job = new HostBindingCompilationJob(
110 input.componentName,
111 constantPool,
112 TemplateCompilationMode.DomOnly,
113 input.legacyOptionalChaining,
114 );
115 for (const property of input.properties ?? []) {
116 let bindingKind = ir.BindingKind.Property;
117 // TODO: this should really be handled in the parser.
118 if (property.name.startsWith('attr.')) {
119 property.name = property.name.substring('attr.'.length);
120 bindingKind = ir.BindingKind.Attribute;
121 }
122 if (property.isLegacyAnimation) {
123 bindingKind = ir.BindingKind.LegacyAnimation;
124 }
125 if (property.isAnimation) {
126 bindingKind = ir.BindingKind.Animation;
127 }
128 const securityContexts = calcHostBindingSecurityContexts(
129 bindingParser,
130 input.componentSelector,
131 property.name,
132 bindingKind === ir.BindingKind.Attribute,
133 );
134 ingestDomProperty(job, property, bindingKind, securityContexts);
135 }
136 for (const [name, expr] of Object.entries(input.attributes) ?? []) {
137 const securityContexts = calcHostBindingSecurityContexts(
138 bindingParser,
139 input.componentSelector,
140 name,
141 true,
142 );
143 ingestHostAttribute(job, name, expr, securityContexts);
144 }
145 for (const event of input.events ?? []) {
146 ingestHostEvent(job, event);
147 }
148 return job;
149}
150
151function calcHostBindingSecurityContexts(
152 bindingParser: BindingParser,

Callers 1

Calls 5

ingestDomPropertyFunction · 0.85
ingestHostAttributeFunction · 0.85
ingestHostEventFunction · 0.85
entriesMethod · 0.45

Tested by

no test coverage detected