Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 1x 1x 243x 243x 243x 243x 243x 254x 243x 61x 182x 243x 243x 254x 243x | import type { Template } from '../../angular-internal/ast.type';
import {
NgNodeKind,
NgNodeMeta,
NgTemplateMeta,
ParsedNode,
} from './interface';
export class ParsedNgTemplate implements ParsedNode<NgTemplateMeta> {
kind = NgNodeKind.Template;
private children: ParsedNode<NgNodeMeta>[] = [];
constructor(
private node: Template,
public parent: ParsedNode<NgNodeMeta> | undefined,
public index: number
) {}
appendNgNodeChild(child: ParsedNode<NgNodeMeta>) {
this.children.push(child);
}
private getTemplateName(): string {
if (this.node.references && this.node.references.length) {
return this.node.references[0].name;
} else {
return `ngDefault_${this.index}`;
}
}
getNodeMeta(): NgTemplateMeta {
const directive = this.getTemplateName()!;
const meta: NgTemplateMeta = {
kind: NgNodeKind.Template,
children: this.children.map((child) => child.getNodeMeta()),
index: this.index,
defineTemplateName: directive,
};
return meta;
}
}
|