2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-06-09 13:23:29 -07:00
|
|
|
import * as common from '@angular/common';
|
2016-07-25 03:02:57 -07:00
|
|
|
import {CUSTOM_ELEMENTS_SCHEMA, Component, Inject, NgModule, 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 {
|
|
|
|
}
|
2016-07-25 03:02:57 -07:00
|
|
|
|
2016-08-02 10:34:41 -07:00
|
|
|
@Component({selector: 'cmp-pipes', template: `<div *ngIf>{{test | somePipe}}</div>`})
|
|
|
|
export class CompUsingPipes {
|
|
|
|
}
|
|
|
|
|
2016-07-25 03:02:57 -07:00
|
|
|
@Component({
|
|
|
|
selector: 'cmp-custom-els',
|
|
|
|
template: `
|
|
|
|
<some-custom-element [someUnknownProp]="true"></some-custom-element>
|
|
|
|
`,
|
|
|
|
})
|
|
|
|
export class CompUsingCustomElements {
|
|
|
|
}
|
|
|
|
|
|
|
|
@NgModule({schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [CompUsingCustomElements]})
|
|
|
|
export class ModuleUsingCustomElements {
|
|
|
|
}
|