Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Created March 13, 2019 02:53
Show Gist options
  • Save phenomnomnominal/072c0224b68d8acf7cec6c8aaebda242 to your computer and use it in GitHub Desktop.
Save phenomnomnominal/072c0224b68d8acf7cec6c8aaebda242 to your computer and use it in GitHub Desktop.
import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
import { Engine } from './engine';
import { Radio } from './radio';
import { Transmission } from './transmission';
import { Wheel } from './wheel';
const WHEELS = new InjectionToken('Wheels');
@Injectable()
class Car {
constructor (
public engine: Engine,
@Optional() public radio: Radio,
@Inject(WHEELS) public wheels: Array<Wheel>,
public transmission: Transmission
) { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment