Closed david-gang closed 9 years ago
This exists via provide
.
import {Component, Inject, provide} from 'ng-forward';
@Component({
selector: 'app',
providers: [
provide('SomeValue', { useValue: 'foo' }),
provide('SomeConst', { useConstant: 'bar' })
]
})
class App {}
@Inject('SomeValue', 'SomeConst')
class SomeOtherThing {
constructor(someVal, someConst) {}
}
Also note that you probably should avoid using provide('SomeConst', { useConstant: 'bar' })
, especially if you are working in an ES6 environment. It would be better to do something like:
const someConst = 'foo';
provide('SomeConst', { useValue: someConst });
We need a way to convert constants and values to the new syntax. As i understand values are supported