GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Tutorials
  • Playground
  • Reference
  • code

This view

  • Original page
  • New address

GeezerVison is showing angular.dev — reflectComponentType • Angular

API

function reflectComponentType<C>(component: Type<C>): ComponentMirror<C> | null;
@paramcomponentType<C>

Component class reference.

@returnsComponentMirror<C> | null

An object that allows to retrieve component metadata.

Usage Notes

The example below demonstrates how to use the function and how the fields of the returned object map to the component metadata.

@Component({
  selector: 'foo-component',
  template: `
    <ng-content></ng-content>
    <ng-content select="content-selector-a"></ng-content>
  `,
})
class FooComponent {
  @Input('inputName') inputPropName: string;
  @Output('outputName') outputPropName = new EventEmitter<void>();
}

const mirror = reflectComponentType(FooComponent);
expect(mirror.type).toBe(FooComponent);
expect(mirror.selector).toBe('foo-component');
expect(mirror.isStandalone).toBe(true);
expect(mirror.inputs).toEqual([{propName: 'inputName', templateName: 'inputPropName'}]);
expect(mirror.outputs).toEqual([{propName: 'outputName', templateName: 'outputPropName'}]);
expect(mirror.ngContentSelectors).toEqual([
  '*',                 // first `<ng-content>` in a template, the selector defaults to `*`
  'content-selector-a' // second `<ng-content>` in a template
]);
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.