Skip to content

Commit

Permalink
refactor: CSSDialogContainer support for ContainerContent (suppor…
Browse files Browse the repository at this point in the history
…t string, TepmlateRef and Components as content)

BREAKING CHANGE: method `CSSDialogContainer.addComponent()` was removed since modal containers are based on `ng-content`. Also removed the bindings for `tabindex` and `role`, they are now static
  • Loading branch information
Shlomi Assaf (shlassaf) committed Aug 30, 2016
1 parent 2e6f6a0 commit 975afea
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/components/angular2-modal/components/css-dialog-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,17 @@ import { Class } from '../framework/utils';
@Component({
selector: 'css-dialog-container',
host: {
'[attr.tabindex]': 'tabIndex',
'[attr.role]': 'role'
'tabindex': '-1',
'role': 'dialog'
},
encapsulation: ViewEncapsulation.None,
template: `<span #modalDialog></span>`
template: `<ng-content></ng-content>`
})
export class CSSDialogContainer extends BaseDynamicComponent {
tabIndex: number = -1;
role: string = 'dialog';

@ViewChild('modalDialog', {read: ViewContainerRef}) private vcRef: ViewContainerRef;

constructor(public dialog: DialogRef<any>,
el: ElementRef, renderer: Renderer) {
super(el, renderer);
this.activateAnimationListener();
}

addComponent<T>(type: Class<T>, bindings?: ResolvedReflectiveProvider[]): ComponentRef<T> {
return super._addComponent<T>(type, this.vcRef, bindings);
}

}

0 comments on commit 975afea

Please sign in to comment.