Project

General

Profile

« Previous | Next » 

Revision 60944

[Aggregator | Trunk]: Add smooth scroll

View differences:

app.component.ts
11 11
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
12 12
import {Subscriber} from "rxjs";
13 13
import {DOCUMENT} from "@angular/common";
14
import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll";
14 15

  
15 16
@Component({
16 17
  selector: 'app-root',
......
53 54
  agg: AggregatorInfo = null;
54 55
  subscriptions = [];
55 56
  
56
  constructor(private userManagementService: UserManagementService,  private configurationService: ConfigurationService,  @Inject(DOCUMENT) private document, private rendererFactory: RendererFactory2) {
57
  constructor(private userManagementService: UserManagementService,
58
              private configurationService: ConfigurationService, private smoothScroll: SmoothScroll,
59
              @Inject(DOCUMENT) private document, private rendererFactory: RendererFactory2) {
57 60
    this.id = ConnectHelper.getCommunityFromDomain(this.properties.domain);
58 61
    this.agg = PortalAggregators.getFilterInfoByMenuId(this.id);
59 62
    this.setStyles();
60 63
    this.configurationService.initStaticCommunityInformation(PortalAggregators.getCommunityInfoByMenuId(this.id));
61 64
  }
62
  ngOnDestroy() {
63
    this.subscriptions.forEach(subscription => {
64
      if (subscription instanceof Subscriber) {
65
        subscription.unsubscribe();
66
      }
67
    });
68
    this.configurationService.clearSubscriptions();
69
    this.userManagementService.clearSubscriptions();
70
  }
65
  
71 66
  ngOnInit() {
72 67
    if (typeof document !== 'undefined') {
73 68
        this.isClient = true;
......
97 92
    }));
98 93
  }
99 94
  
95
  ngOnDestroy() {
96
    this.subscriptions.forEach(subscription => {
97
      if (subscription instanceof Subscriber) {
98
        subscription.unsubscribe();
99
      }
100
    });
101
    this.configurationService.clearSubscriptions();
102
    this.userManagementService.clearSubscriptions();
103
    this.smoothScroll.clearSubscriptions();
104
  }
105
  
100 106
  private buildMenu() {
101 107
    this.menuItems = [
102 108
      {rootItem: new MenuItem("home", "Home", "", "/", false, [], null, {}), items: []},

Also available in: Unified diff