I have a simple component that should control the display classes on my datatables. The only way I can get it to work is have the datatable load inside the actual component. The buttons don't work on datatables in other components. I am importing the class and putting in the directive but it's still not seeming to work outside it own nested scope.
import {Component} from 'angular2/core';
import {NgClass} from 'angular2/common';
import {DataTable} from '../../components/datatable/datatable';
import {TestDatatable} from "../../views/grids/testDatatable";
@Component({
selector: 'show-parent',
inputs: ['isDisabled'],
directives: [NgClass, TestDatatable],
template: `
<i class="fa fa-sitemap" (click)="toggleOpen($event)"></i>
<i class="fa fa-th-large" (click)="toggleSplitScreen($event)"></i>
//The buttons work on this datatable below but if I move
// this selector somewhere else it no longer works
<myDatatable [ngClass]="{'panel-open': isOpen, 'panel-split':
isSplit}" class="parent-grid"></myDatable>
`
})
export class ShowParent {
isOpen = false;
isSplit = false;
toggleOpen(event) {
event.preventDefault();
this.isOpen = !this.isOpen;
}
toggleSplitScreen(event) {
event.preventDefault();
this.isSplit = !this.isSplit;
}
}