Angular Modernizer
    Preparing search index...
    • Parses one Angular template with @angular/compiler and returns its structure: every element with its bindings, the pipes used, control-flow nesting and the i18n keys it references.

      Parameters

      Returns TemplateInspection

      Elements, pipes, control flow and i18n keys. Keys and elements are in source order.

      Pure function over template text; it knows nothing about ts-morph. Which component or directive an element matches is resolved one level up in TemplateInspector. Offsets point into the template text so callers can map them to an external .html file or an inline template: literal.

      Structural directives written as *ngIf produce an inline template node in the compiler AST. The inspector folds such a node into the element it wraps: the element carries the directive as a structural binding.

      Returns an empty result when the @angular/compiler AST classes are missing (e.g. replaced by a test mock).

      const result = inspectTemplate('<app-item [item]="i" (saved)="save()"></app-item>');
      // result.elements[0] -> { tag: 'app-item', bindings: [{ kind: 'input', name: 'item', ... }, ...] }