Playing around with Angular 2 and trying to get this simple code working. yet I keep getting an error of:
EXCEPTION: Cannot resolve all parameters for Ta
That's because your Tabs
class is defined after your Tab
class and classes in javascript aren't hoisted.
So you have to use forwardRef to reference a not yet defined class.
export class Tab {
@Input() tabTitle: string;
public active:boolean;
constructor(@Inject(forwardRef(() => Tabs)) tabs:Tabs) {
this.active = false;
tabs.addTab(this);
}
}