mirror of
https://github.com/google/nomulus.git
synced 2025-07-23 19:20:44 +02:00
Close sidenav on click (#2156)
It shouldn't stick around after we've clicked on one of the links
This commit is contained in:
parent
a87c4a31a3
commit
0801679173
1 changed files with 17 additions and 2 deletions
|
@ -12,10 +12,12 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component, ViewChild } from '@angular/core';
|
||||||
import { RegistrarService } from './registrar/registrar.service';
|
import { RegistrarService } from './registrar/registrar.service';
|
||||||
import { UserDataService } from './shared/services/userData.service';
|
import { UserDataService } from './shared/services/userData.service';
|
||||||
import { GlobalLoaderService } from './shared/services/globalLoader.service';
|
import { GlobalLoaderService } from './shared/services/globalLoader.service';
|
||||||
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
|
import { MatSidenav } from '@angular/material/sidenav';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
|
@ -24,10 +26,15 @@ import { GlobalLoaderService } from './shared/services/globalLoader.service';
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
renderRouter: boolean = true;
|
renderRouter: boolean = true;
|
||||||
|
|
||||||
|
@ViewChild('sidenav')
|
||||||
|
sidenav!: MatSidenav;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected registrarService: RegistrarService,
|
protected registrarService: RegistrarService,
|
||||||
protected userDataService: UserDataService,
|
protected userDataService: UserDataService,
|
||||||
protected globalLoader: GlobalLoaderService
|
protected globalLoader: GlobalLoaderService,
|
||||||
|
protected router: Router
|
||||||
) {
|
) {
|
||||||
registrarService.activeRegistrarIdChange.subscribe(() => {
|
registrarService.activeRegistrarIdChange.subscribe(() => {
|
||||||
this.renderRouter = false;
|
this.renderRouter = false;
|
||||||
|
@ -36,4 +43,12 @@ export class AppComponent {
|
||||||
}, 400);
|
}, 400);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
this.router.events.subscribe((event) => {
|
||||||
|
if (event instanceof NavigationEnd) {
|
||||||
|
this.sidenav.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue