AngularTS
    Preparing search index...

    Interface Directive<TCtrl, TRequired, TScope, TElement>

    Defines the structure of an AngularTS directive.

    interface Directive<
        TCtrl = unknown,
        TRequired = DirectiveController | undefined,
        TScope extends ng.Scope = ng.Scope,
        TElement extends Element = Element,
    > {
        bindToController?: boolean | ControllerBindings<NoInfer<TCtrl>>;
        compile?: (
            templateElement: HTMLElement,
            transclude?: ChildTranscludeOrLinkFn,
        ) => DirectiveLinkFn<unknown> | DirectivePrePost | undefined;
        controller?:
            | string
            | Injectable<
                ControllerConstructor<
                    TCtrl & object & {
                        afterRender?: () => void;
                        name?: string;
                        onChanges?: (changes: OnChangesObject) => void;
                        onDestroy?: () => void;
                        onInit?: () => void;
                        postLink?: () => void;
                    },
                >,
            >
            | [
                ...string[],
                ControllerConstructor<
                    TCtrl & object & {
                        afterRender?: () => void;
                        name?: string;
                        onChanges?: (changes: OnChangesObject) => void;
                        onDestroy?: () => void;
                        onInit?: () => void;
                        postLink?: () => void;
                    },
                >,
            ];
        controllerAs?: string;
        count?: number;
        link?: DirectiveLinkFn<TCtrl>
        | DirectivePrePost;
        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>;
        view?: (
            context: ProgrammaticViewContext<TCtrl, TRequired, TScope, TElement>,
        ) => ProgrammaticViewChild;
    }

    Type Parameters

    • TCtrl = unknown
    • TRequired = DirectiveController | undefined
    • TScope extends ng.Scope = ng.Scope
    • TElement extends Element = Element
    Index

    Properties

    bindToController?: boolean | ControllerBindings<NoInfer<TCtrl>>

    Bind attributes to controller properties. Known controller types restrict binding names and require callable properties for & callbacks. true uses the bindings declared in scope; false leaves them on the scope.

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

    Compile function for the directive

    controller?:
        | string
        | Injectable<
            ControllerConstructor<
                TCtrl & object & {
                    afterRender?: () => void;
                    name?: string;
                    onChanges?: (changes: OnChangesObject) => void;
                    onDestroy?: () => void;
                    onInit?: () => void;
                    postLink?: () => void;
                },
            >,
        >
        | [
            ...string[],
            ControllerConstructor<
                TCtrl & object & {
                    afterRender?: () => void;
                    name?: string;
                    onChanges?: (changes: OnChangesObject) => void;
                    onDestroy?: () => void;
                    onInit?: () => void;
                    postLink?: () => void;
                },
            >,
        ]

    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

    Real-DOM view factory. It is mutually exclusive with template, templateUrl, and replace and composes with compile/link.