DEV Community

 Shivaram Ayyalasomayajula
Shivaram Ayyalasomayajula

Posted on

What is @SkipSelf decorator in Angular?

2

The @SkipSelf decorator tells DI to look for a dependency in the whole tree starting from the parent injector

I came across the @SkipSelf decorator as below. What does this @SkipSelfdecorator exactly mean in this case?

class Dependency {}
@Injectable()
class NeedsDependency {
  constructor(@SkipSelf() public dependency: Dependency) { this.dependency

Top comments (1)

Collapse
 
alainvanhout profile image
Alain Van Hout

It's explained in the docs: angular.io/api/core/SkipSelf

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more