- Interface needs Export. If something is not recognized check for Export
@Component({
selector: 'my-comp',
template: `
<input #myInput type="text" />
<div> Some other content </div>
`
})
export class MyComp implements AfterViewInit {
@ViewChild('myInput') input: ElementRef;
constructor(private renderer: Renderer) {}
ngAfterViewInit() {
this.renderer.invokeElementMethod(this.input.nativeElement,
'focus');
}
}
// user code
<my-list>
<li *ngFor="let item of items"> {{item}} </li>
</my-list>
@Directive({ selector: 'li' })
export class ListItem {}
// component code
@Component({
selector: 'my-list'
})
export class MyList implements AfterContentInit {
@ContentChildren(ListItem) items: QueryList<ListItem>;
ngAfterContentInit() {
// do something with list items
}
}
Refer to cheatsheet
in vendor.browser.ts import 'fabric';
declare var fabric:any;