Skip to content

Commit

Permalink
feat(sidenav): open all sidenavs from MdSidenavContainer
Browse files Browse the repository at this point in the history
- added `open` and `close` functions that applies to both sidenavs in the container and resolves when both are finished

fixes #2591
  • Loading branch information
EladBezalel committed Jan 30, 2017
1 parent 3b6cab0 commit 4cdb828
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/lib/sidenav/sidenav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,36 @@ export class MdSidenavContainer implements AfterContentInit {
this._validateDrawers();
}

/** Calls `open` of both start and end sidenavs */
public open() {
const promises: Promise<MdSidenavToggleResult>[] = [];

if (this._start) {
promises.push(this._start.open());
}

if (this._end) {
promises.push(this._end.open());
}

return Promise.all(promises);
}

/** Calls `close` of both start and end sidenavs */
public close() {
const promises: Promise<MdSidenavToggleResult>[] = [];

if (this._start) {
promises.push(this._start.close());
}

if (this._end) {
promises.push(this._end.close());
}

return Promise.all(promises);
}

/**
* Subscribes to sidenav events in order to set a class on the main container element when the
* sidenav is open and the backdrop is visible. This ensures any overflow on the container element
Expand Down

0 comments on commit 4cdb828

Please sign in to comment.