Socket
Book a DemoInstallSign in
Socket

@angular-ru/autowired

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular-ru/autowired

```bash $ npm install --save-dev @angular-ru/autowired ```

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Simple Dependency Injection with BeanAccessible

$ npm install --save-dev @angular-ru/autowired

The decorator @Autowired tells the Angular application that the class it is underlined is a service, that is, a candidate for automatic detection (DI).

Before

app.module.ts

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule],
  providers: [ServiceA, ServiceB, ServiceC, ServiceD],
  bootstrap: [AppComponent]
})
export class AppModule { }

base.component.ts

export class BaseComponent {
 constructor(
    private c: ServiceC, 
    private d: ServiceD
 ) {}
 
 ...
}

app.component.ts

export class AppComponent extends BaseComponent {
 constructor(
    private a: ServiceC, 
    private b: ServiceD, 
    private c: ServiceC, 
    private d: ServiceD
 ) {
   super(c, d);
 }
 
 ...
}

After

app.module.ts

@NgModule({
  declarations: [AppComponent],
  imports: [
     BrowserModule,
     BeanAccessibleModule.forRoot()
  ],
  providers: [ServiceA, ServiceB, ServiceC, ServiceD],
  bootstrap: [AppComponent]
})
export class AppModule { }

base.component.ts

export class BaseComponent {
 @Autowired() private c: ServiceC;
 @Autowired() private d: ServiceD;
 
 ...
}

app.component.ts

export class AppComponent extends BaseComponent {
 @Autowired() private a: ServiceA;
 @Autowired() private b: ServiceB;
 
 ...
}

Decorator @Autowired

The decorator @Autowired tells the Angular application that the class it is underlined is a service, that is, a candidate for automatic detection (DI).

FAQs

Package last updated on 10 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.