Angular Modernizer
    Preparing search index...

    Inspects component templates of a ts-morph project.

    Project-level companion to inspectTemplate: loads a component's template (inline or templateUrl), inspects it, maps offsets to file positions and resolves elements and pipes to the components, directives and pipes declared in the project (via DirectiveIndex).

    const inspector = new TemplateInspector(project);
    const [report] = inspector.inspectFile('/src/app/list/list.component.html');
    // report.elements[0] -> { tag: 'app-item', line: 3, matches: ['ItemComponent'], bindings: [...] }
    Index

    Constructors

    Methods

    • Inspects the template of one component class.

      Parameters

      • cls: ClassDeclaration

      Returns ComponentTemplateReport | undefined

      The report, or undefined when the class has no template.

    • Inspects the templates behind a file: the owners of an .html template, or every component declared in a .ts file (optionally one class).

      Parameters

      • filePath: string

        .html template or .ts file.

      • OptionalclassName: string

        Only inspect this class.

      Returns ComponentTemplateReport[]

      One report per component; empty when the file holds no template.