MCPcopy Index your code
hub / github.com/angular/angular / compileHostMetadata

Function compileHostMetadata

packages/compiler/src/render3/partial/directive.ts:210–231  ·  view source on GitHub ↗

* Compiles the host metadata into its partial declaration form as declared * in `R3DeclareDirectiveMetadata['host']`

(meta: R3HostMetadata)

Source from the content-addressed store, hash-verified

208 * in `R3DeclareDirectiveMetadata['host']`
209 */
210function compileHostMetadata(meta: R3HostMetadata): o.LiteralMapExpr | null {
211 const hostMetadata = new DefinitionMap<NonNullable<R3DeclareDirectiveMetadata['host']>>();
212 hostMetadata.set(
213 'attributes',
214 toOptionalLiteralMap(meta.attributes, (expression) => expression),
215 );
216 hostMetadata.set('listeners', toOptionalLiteralMap(meta.listeners, o.literal));
217 hostMetadata.set('properties', toOptionalLiteralMap(meta.properties, o.literal));
218
219 if (meta.specialAttributes.styleAttr) {
220 hostMetadata.set('styleAttribute', o.literal(meta.specialAttributes.styleAttr));
221 }
222 if (meta.specialAttributes.classAttr) {
223 hostMetadata.set('classAttribute', o.literal(meta.specialAttributes.classAttr));
224 }
225
226 if (hostMetadata.values.length > 0) {
227 return hostMetadata.toLiteralMap();
228 } else {
229 return null;
230 }
231}
232
233function createHostDirectives(
234 hostDirectives: NonNullable<R3DirectiveMetadata['hostDirectives']>,

Callers 1

Calls 3

setMethod · 0.95
toLiteralMapMethod · 0.95
toOptionalLiteralMapFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…