2016-06-09 13:23:29 -07:00
|
|
|
import * as common from '@angular/common';
|
2016-06-08 16:38:52 -07:00
|
|
|
import {Component, Inject, OpaqueToken} from '@angular/core';
|
2016-04-30 16:13:03 -07:00
|
|
|
|
2016-06-13 15:56:51 -07:00
|
|
|
import {wrapInArray} from './funcs';
|
|
|
|
|
2016-04-30 16:13:03 -07:00
|
|
|
export const SOME_OPAQUE_TOKEN = new OpaqueToken('opaqueToken');
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'comp-providers',
|
|
|
|
template: '',
|
|
|
|
providers: [
|
|
|
|
{provide: 'strToken', useValue: 'strValue'},
|
|
|
|
{provide: SOME_OPAQUE_TOKEN, useValue: 10},
|
2016-06-09 13:23:29 -07:00
|
|
|
{provide: 'reference', useValue: common.NgIf},
|
2016-04-30 16:13:03 -07:00
|
|
|
{provide: 'complexToken', useValue: {a: 1, b: ['test', SOME_OPAQUE_TOKEN]}},
|
|
|
|
]
|
|
|
|
})
|
|
|
|
export class CompWithProviders {
|
2016-05-07 09:20:56 -06:00
|
|
|
constructor(@Inject('strToken') public ctxProp: string) {}
|
2016-04-30 16:13:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'cmp-reference',
|
|
|
|
template: `
|
|
|
|
<input #a>{{a.value}}
|
|
|
|
<div *ngIf="true">{{a.value}}</div>
|
|
|
|
`,
|
2016-06-13 15:56:51 -07:00
|
|
|
directives: [wrapInArray(common.NgIf)]
|
2016-04-30 16:13:03 -07:00
|
|
|
})
|
|
|
|
export class CompWithReferences {
|
|
|
|
}
|