本文整理汇总了TypeScript中@angular/compiler.StaticReflector.findDeclaration方法的典型用法代码示例。如果您正苦于以下问题:TypeScript StaticReflector.findDeclaration方法的具体用法?TypeScript StaticReflector.findDeclaration怎么用?TypeScript StaticReflector.findDeclaration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/compiler.StaticReflector
的用法示例。
在下文中一共展示了StaticReflector.findDeclaration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should get constructor for NgFor', () => {
const NgFor = reflector.findDeclaration('@angular/common/src/directives/ng_for', 'NgFor');
const ViewContainerRef = reflector.findDeclaration('@angular/core', 'ViewContainerRef');
const TemplateRef = reflector.findDeclaration('@angular/core', 'TemplateRef');
const IterableDiffers = reflector.findDeclaration('@angular/core', 'IterableDiffers');
const ChangeDetectorRef = reflector.findDeclaration('@angular/core', 'ChangeDetectorRef');
const parameters = reflector.parameters(NgFor);
expect(parameters).toEqual([
[ViewContainerRef], [TemplateRef], [IterableDiffers], [ChangeDetectorRef]
]);
});
示例2: it
it('should get propMetadata for HeroDetailComponent', () => {
const HeroDetailComponent =
reflector.findDeclaration('src/app/hero-detail.component', 'HeroDetailComponent');
const props = reflector.propMetadata(HeroDetailComponent);
expect(props['hero']).toBeTruthy();
expect(props['onMouseOver']).toEqual([new HostListener('mouseover', ['$event'])]);
});
示例3: it
it('should get annotations for HeroDetailComponent', () => {
const HeroDetailComponent =
reflector.findDeclaration('src/app/hero-detail.component', 'HeroDetailComponent');
const annotations = reflector.annotations(HeroDetailComponent);
expect(annotations.length).toEqual(1);
const annotation = annotations[0];
expect(annotation.selector).toEqual('my-hero-detail');
});