@nx-ddd/core
TypeScript icon, indicating that this package has built-in type declarations

17.4.0 • Public • Published

NxDDD Core

@nx-ddd/core is a wrapper library that allows the use of Angular's hierarchical injector in backend or CLI environments.

Install

$ npm i @nx-ddd/core

Usage

import '@angular/compiler';
import { Injectable } from '@angular/core';
import { bootstrap } from './index';

@Injectable()
export abstract class Repository {
  abstract name: string;
}

@Injectable()
export class RepositoryImpl extends Repository {
  name = 'RepositoryImpl.name';
}

@Injectable({providedIn: 'root'})
export class AppService {
  constructor(public repository: Repository) { }
}

async function main() {
  const injector = await bootstrap([
    // Inject RepositoryImpl
    { provide: Repository, useClass: RepositoryImpl},
  ]);
  const app = injector.get(AppService);
  console.debug('app.repository.name:', app.repository.name);
}

LISENCE

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @nx-ddd/core

Weekly Downloads

519

Version

17.4.0

License

none

Unpacked Size

23.1 kB

Total Files

38

Last publish

Collaborators

  • machina-owner
  • nontan