Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aurelia-property-injection

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aurelia-property-injection

An extension to Aurelia's DI container which supports injection into properties.

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

aurelia-property-injection

npm version CircleCI

This plugin enables the core Aurelia's DI Container to inject dependencies into class instance properties, lifting the constructor from being the dependency bearer and decoupling child classes from parent dependencies.

The implementation follows the Convention over configuration paradigm, assuming the presence of a static injectProperties enumeration of property: Type to satisfy dependencies. For example, having a class like this:

import {Router} from 'aurelia-router';

export class MyClass {

  static injectProperties = {
    router: Router
  };

}

the container will produce an instance of MyClass with the current Router available in the router property.

It also provides extended implementations of the core inject and autoinject decorators, e.g.

import {inject} from 'aurelia-property-injection';
import {Router} from 'aurelia-router';

export class MyClass {

  @inject(Router)
  router;

}

and for TypeScript

import {autoinject} from 'aurelia-property-injection';

export class MyClass {

  @autoinject
  private router: Router;

}

Installing the plugin

Install the plugin via NPM:

npm install --save aurelia-property-injection

Enabling the plugin

To enable the plugin, simply use it in the Aurelia's main configuration of your application:

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .developmentLogging()
    .plugin('aurelia-property-injection');

  aurelia.start().then(() => aurelia.setRoot());
}

Keywords

FAQs

Package last updated on 17 Dec 2016

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc