### File

`src/experimental.module.ts`

### Providers

- ExperimentalService

    import { NgModule, SkipSelf, Optional } from "@angular/core";
    import { ExperimentalService } from "./experimental.service";

    // either provides a new instance of ExperimentalService, or returns the parent
    export function EXPERIMENTAL_SERVICE_PROVIDER_FACTORY(parentService: ExperimentalService) {
    	return parentService || new ExperimentalService();
    }

    export const EXPERIMENTAL_SERVICE_PROVIDER = {
    	provide: ExperimentalService,
    	deps: [[new Optional(), new SkipSelf(), ExperimentalService]],
    	useFactory: EXPERIMENTAL_SERVICE_PROVIDER_FACTORY
    };

    @NgModule({
    	providers: [
    		ExperimentalService,
    		EXPERIMENTAL_SERVICE_PROVIDER
    	]
    })
    class ExperimentalModule { }

    export {
    	ExperimentalService,
    	ExperimentalModule
    };

# result-matching ""

# No results matching ""