scrollService fix

master
Boris Voropaev 2023-11-07 10:46:21 +03:00
parent 164200532c
commit 7be11672a5
2 changed files with 8 additions and 4 deletions

View File

@ -2,7 +2,6 @@ import {Component} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
import {FormControl, FormGroup} from "@angular/forms"; import {FormControl, FormGroup} from "@angular/forms";
import {FormsService, ListsService} from "@app/_services"; import {FormsService, ListsService} from "@app/_services";
import {WindowScrollingService} from "@app/_services/window-scrolling.service";
import { PagesService } from '@app/_services/pages.service'; import { PagesService } from '@app/_services/pages.service';
@ -32,7 +31,6 @@ export class SliderFormComponent {
private formsService: FormsService, private formsService: FormsService,
private listsService: ListsService, private listsService: ListsService,
private pagesService: PagesService, private pagesService: PagesService,
private windowScrollingService: WindowScrollingService
) { ) {
} }
@ -57,7 +55,6 @@ export class SliderFormComponent {
this.initFormGroup(JSON.parse(this.route.snapshot.queryParamMap.get('extraProps'))); this.initFormGroup(JSON.parse(this.route.snapshot.queryParamMap.get('extraProps')));
this.formParams = JSON.parse(this.route.snapshot.queryParamMap.get('formParams')) || {}; this.formParams = JSON.parse(this.route.snapshot.queryParamMap.get('formParams')) || {};
this.fetch(); this.fetch();
this.windowScrollingService.disable();
} }
fetch() { fetch() {
@ -146,7 +143,7 @@ export class SliderFormComponent {
} }
close() { close() {
this.windowScrollingService.enable();
this.router.navigate([{outlets: {slider: null}}]).then(); this.router.navigate([{outlets: {slider: null}}]).then();
} }
} }

View File

@ -1,5 +1,6 @@
import { AfterViewInit, Component, Input, OnInit } from '@angular/core'; import { AfterViewInit, Component, Input, OnInit } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { WindowScrollingService } from '@app/_services/window-scrolling.service';
@Component({ @Component({
selector: 'slider', selector: 'slider',
@ -9,19 +10,25 @@ import { Router } from '@angular/router';
export class SliderComponent implements OnInit { export class SliderComponent implements OnInit {
@Input() width: 'string'; @Input() width: 'string';
@Input() side: 'left'|'right' ='right'; @Input() side: 'left'|'right' ='right';
css:any; css:any;
constructor( constructor(
private windowScrollingService: WindowScrollingService,
private router:Router private router:Router
){} ){}
ngOnInit(){ ngOnInit(){
this.windowScrollingService.disable();
this.css = { this.css = {
'left-side': this.side=='left', 'left-side': this.side=='left',
'right-side': this.side=='right' 'right-side': this.side=='right'
} }
} }
ngOnDestroy(){
this.windowScrollingService.enable();
}
close() { close() {