1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Angular | Inject service into decorator

Discussão em 'Angular' iniciado por user8116198, Outubro 25, 2024 às 05:42.

  1. user8116198

    user8116198 Guest

    I am trying to inject a service into a decorator function in which I am creating, this is so I can get the contents that are stored inside of variables.

    I currently have a basic decorator setup.

    export function canEdit(editName: string, service: Service) {
    return function (constructor: any) {
    console.log(constructor);
    }
    }


    Where I am using this it is asking me for the second parameter, which obviously needs to be dependency injected.

    I have also tried the @Inject(Service) which isn't allowed within functions.

    Is there a way that I can do this?

    Or is it possible to get the parent classes variables within the decorator?

    Continue reading...

Compartilhe esta Página