refactor(aio): move window:resize handler into component

This commit is contained in:
Peter Bacon Darwin 2017-03-12 14:07:49 +00:00 committed by Chuck Jazdzewski
parent eaa04354d5
commit f600d4e9e4
2 changed files with 2 additions and 1 deletions

View File

@ -5,7 +5,7 @@
<span class="fill-remaining-space"></span>
</md-toolbar>
<md-sidenav-container class="sidenav-container" (window:resize)="onResize($event.target.innerWidth)">
<md-sidenav-container class="sidenav-container">
<md-sidenav #sidenav class="sidenav" [opened]="isSideBySide" [mode] = "isSideBySide ? 'side' : 'over'">
<aio-top-menu *ngIf="!isSideBySide" class="small" [nodes]="(navigationViews | async)?.TopBar" [homeImageUrl]="homeImageUrl"></aio-top-menu>

View File

@ -43,6 +43,7 @@ export class AppComponent implements OnInit {
this.onResize(window.innerWidth);
}
@HostListener('window:resize', ['$event.target.innerWidth'])
onResize(width) {
this.isSideBySide = width > this.sideBySideWidth;
}