Project

General

Profile

« Previous | Next » 

Revision 60197

[Usage-Counts | Trunk]: Fix search bug on alalytics. Change loading

View differences:

resources.component.ts
1
import {Component, HostListener, OnInit} from '@angular/core';
1
import {Component, HostListener, OnDestroy, OnInit} from '@angular/core';
2 2
import {Meta, Title} from '@angular/platform-browser';
3 3
import {ActivatedRoute, Router} from '@angular/router';
4 4
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
5 5
import {properties} from '../../environments/environment';
6
import {Subscription} from 'rxjs';
6
import {Subscriber, Subscription} from 'rxjs';
7 7
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
8 8
import {SEOService} from '../openaireLibrary/sharedComponents/SEO/SEO.service';
9 9

  
......
12 12
  templateUrl: 'resources.component.html',
13 13
  styleUrls: ['resources.component.css'],
14 14
})
15
export class ResourcesComponent implements OnInit {
15
export class ResourcesComponent implements OnInit, OnDestroy {
16 16
  properties: EnvProperties = properties;
17 17
  description = "OpenAIRE Provide. The resources of the OpenAIRE UsageCounts Service are available through the OpenAIRE PROVIDE product, which is serving the content providers. APIs and Reports.";
18 18
  title = "OpenAIRE - UsageCounts | Resources";
......
56 56
    }));
57 57
  }
58 58
  
59
  public ngOnDestroy() {
60
    this.subs.forEach(subscription => {
61
      if (subscription instanceof Subscriber) {
62
        subscription.unsubscribe();
63
      }
64
    });
65
  }
66
  
59 67
  goTo(id: string) {
60 68
    const yOffset = -100;
61 69
    const element = document.getElementById(id);
......
64 72
      window.scrollTo({top: y, behavior: 'smooth'});
65 73
    }
66 74
  }
67
  public ngOnDestroy() {
68
    for (let sub of this.subs) {
69
      sub.unsubscribe();
70
    }
71
  }
72 75
}

Also available in: Unified diff