Angular Modernizer
    Preparing search index...

    Finds the template hosts of a component or directive.

    Answers "where is this component (or directive) used, and what does each host bind on it?": every template element matching the target's selector, grouped by the component whose template contains it, with bound, unbound and missing required inputs/outputs.

    Builds on inspectTemplate (bindings per element), DirectiveIndex (selector matching with the compiler's SelectorMatcher) and collectDirectiveIO (inputs/outputs incl. aliases, signal APIs and base classes). Template hosts are component templates in the ts-morph program. Components created in code (dialogs, createComponent, portals, routes, project wrappers around them) are listed separately as dynamicHosts by DynamicHostFinder.

    const result = new ComponentHostFinder(project).findHosts({ className: 'ItemComponent' });
    // result.hosts[0] -> { component: 'ListComponent', occurrences: [...], unboundOutputs: ['formError'] }
    // result.coverage.outputs.formError -> { boundIn: ['ListComponent'], unboundIn: ['GridComponent', 'CardComponent'] }
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Finds the hosts of the best-matching class: exact class name (and file), then exact selector, then selectors containing the given one. Other matches go to alternatives.

      Parameters

      Returns ComponentHostResult

      Hosts, coverage and counts; no target when nothing matched.

      Error when the query names neither a class nor a selector.