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