Browse Source

Merge pull request #11777 from abpframework/Issue-11617

navBar collapse added when route is changed
pull/11797/head
Muhammed Altuğ 4 years ago
committed by GitHub
parent
commit
b5c94de0d1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.ts
  2. 10
      npm/ng-packs/packages/theme-basic/src/lib/services/layout.service.ts

5
npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.ts

@ -1,8 +1,9 @@
import { eLayoutType, SubscriptionService } from '@abp/ng.core'; import {eLayoutType, SubscriptionService} from '@abp/ng.core';
import { collapseWithMargin, slideFromBottom } from '@abp/ng.theme.shared'; import { collapseWithMargin, slideFromBottom } from '@abp/ng.theme.shared';
import { AfterViewInit, Component } from '@angular/core'; import {AfterViewInit, Component} from '@angular/core';
import { LayoutService } from '../../services/layout.service'; import { LayoutService } from '../../services/layout.service';
@Component({ @Component({
selector: 'abp-layout-application', selector: 'abp-layout-application',
templateUrl: './application-layout.component.html', templateUrl: './application-layout.component.html',

10
npm/ng-packs/packages/theme-basic/src/lib/services/layout.service.ts

@ -1,4 +1,4 @@
import { SubscriptionService } from '@abp/ng.core'; import {RouterEvents, SubscriptionService} from '@abp/ng.core';
import { ChangeDetectorRef, Injectable } from '@angular/core'; import { ChangeDetectorRef, Injectable } from '@angular/core';
import { fromEvent } from 'rxjs'; import { fromEvent } from 'rxjs';
import { debounceTime } from 'rxjs/operators'; import { debounceTime } from 'rxjs/operators';
@ -16,7 +16,13 @@ export class LayoutService {
navItemsComponentKey = eThemeBasicComponents.NavItems; navItemsComponentKey = eThemeBasicComponents.NavItems;
constructor(private subscription: SubscriptionService, private cdRef: ChangeDetectorRef) {} constructor(private subscription: SubscriptionService,
private cdRef: ChangeDetectorRef,
routerEvents:RouterEvents) {
subscription.addOne(routerEvents.getNavigationEvents("End"),() => {
this.isCollapsed = true;
})
}
private checkWindowWidth() { private checkWindowWidth() {
const isSmallScreen = window.innerWidth < 992; const isSmallScreen = window.innerWidth < 992;

Loading…
Cancel
Save