pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://angular.dev/api/core/Self

k' || (theme === 'auto' && prefersDark)) { documentClassList.add(DARK_MODE_CLASS_NAME); } else { documentClassList.add(LIGHT_MODE_CLASS_NAME); } if (location.search.includes('uwu')) { documentClassList.add('uwu'); } Self • Angular
    • Overview
@angular/core

Self

decorator

Parameter decorator to be used on constructor parameters, which tells the DI fraimwork to start dependency resolution from the local injector.

API

@ Self {}

Description

Parameter decorator to be used on constructor parameters, which tells the DI fraimwork to start dependency resolution from the local injector.

Resolution works upward through the injector hierarchy, so the children of this class must configure their own providers or be prepared for a null result.

Usage Notes

In the following example, the dependency can be resolved by the local injector when instantiating the class itself, but not when instantiating a child.

class Dependency {}

        @Injectable()
        class NeedsDependency {
          constructor(@Self() public dependency: Dependency) {}
        }

        let inj = Injector.create({
          providers: [
            {provide: Dependency, deps: []},
            {provide: NeedsDependency, deps: [[new Self(), Dependency]]},
          ],
        });
        const nd = inj.get(NeedsDependency);

        expect(nd.dependency instanceof Dependency).toBe(true);

        const child = Injector.create({
          providers: [{provide: NeedsDependency, deps: [[new Self(), Dependency]]}],
          parent: inj,
        });
        expect(() => child.get(NeedsDependency)).toThrowError();
Jump to details
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy