How to inject a service in the configuration file in Angular

Discussão em 'Angular' iniciado por Prashant Pimpale, Setembro 11, 2025.

  1. I have below piece of code which return the array of the input fields:

    import { MyService } from "my-service";

    export const INPUTCONFIG = (myService: MyService) => [
    inputsFactory<TextInput, ITextInput>({
    type: 'text',
    isMandatory: true,
    attributes: {
    disable: myService.IsInputDisabled(), // this is not working getting error - Cannot find a differ supporting object 'function (myService)'
    }
    })]


    Below is my service code:

    import { Injectable, Inject } from "@angular/core";

    @Injectable()
    export class MyService {

    IsInputDisabled(){
    return true; // get value from API call
    }
    }

    Continue reading...

Compartilhe esta Página