AngularTS
    Preparing search index...

    Interface Directive<TCtrl>

    Defines the structure of an AngularTS directive.

    interface Directive<TCtrl = unknown> {
        bindToController?: boolean | Record<string, string>;
        compile?: (
            templateElement: HTMLElement,
            transclude?: ChildTranscludeOrLinkFn,
        ) => DirectiveLinkFn<unknown> | DirectivePrePost | undefined;
        controller?: string | Injectable<ControllerConstructor>;
        controllerAs?: string;
        count?: number;
        link?: DirectivePrePost | DirectiveLinkFn<TCtrl>;
        name?: string;
        priority?: number;
        replace?: boolean;
        require?: string | Record<string, string> | string[];
        restrict?: DirectiveRestrict;
        scope?: boolean | Record<string, string>;
        template?: string | ((element: HTMLElement) => string);
        templateNamespace?: string;
        templateUrl?: string | ((element: HTMLElement) => string);
        terminal?: boolean;
        transclude?: string | boolean | Record<string, string>;
    }

    Type Parameters

    • TCtrl = unknown
    Index

    Properties

    bindToController?: boolean | Record<string, string>

    Whether to bind scope to controller

    compile?: (
        templateElement: HTMLElement,
        transclude?: ChildTranscludeOrLinkFn,
    ) => DirectiveLinkFn<unknown> | DirectivePrePost | undefined

    Compile function for the directive

    controller?: string | Injectable<ControllerConstructor>

    Controller constructor or injectable string name

    controllerAs?: string

    Alias name for the controller in templates

    count?: number

    Currently only used by view directive

    Link function(s) executed during linking

    name?: string

    Optional name (usually inferred)

    priority?: number

    Priority of the directive

    replace?: boolean

    Replaces the element with the template if true

    require?: string | Record<string, string> | string[]

    Required controllers for the directive

    restrict?: DirectiveRestrict

    Restrict option: 'A' and/or 'E'. Defaults to 'EA' if not defined

    scope?: boolean | Record<string, string>

    Scope configuration (true, false, or object for isolate scope)

    template?: string | ((element: HTMLElement) => string)

    Inline template

    templateNamespace?: string

    Template namespace (e.g., SVG, HTML)

    templateUrl?: string | ((element: HTMLElement) => string)

    Template URL for loading from server

    terminal?: boolean

    Stops further directive processing if true

    transclude?: string | boolean | Record<string, string>

    Enables transclusion or configures named slots