Project

General

Profile

« Previous | Next » 

Revision 60197

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

View differences:

contact.component.ts
1
import {Component, OnInit, ViewChild} from '@angular/core';
1
import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
2 2
import {Router} from '@angular/router';
3 3
import {EmailService} from '../openaireLibrary/utils/email/email.service';
4 4
import {Email} from '../openaireLibrary/utils/email/email';
......
8 8
import {HelperFunctions} from '../openaireLibrary/utils/HelperFunctions.class';
9 9
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
10 10
import {properties} from '../../environments/environment';
11
import {Subscription} from 'rxjs';
11
import {Subscriber, Subscription} from 'rxjs';
12 12
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
13 13
import {SEOService} from '../openaireLibrary/sharedComponents/SEO/SEO.service';
14 14

  
......
18 18
  styleUrls: ['contact.component.css']
19 19
})
20 20

  
21
export class ContactComponent implements OnInit {
21
export class ContactComponent implements OnInit, OnDestroy {
22 22
  public showLoading = true;
23 23
  public errorMessage = '';
24 24
  public email: Email;
......
27 27
  public contactForm: FormGroup;
28 28
  @ViewChild('AlertModal') modal;
29 29
  @ViewChild('recaptcha') recaptcha;
30
  description = "Any questions? Contact us ";
31
  title = "OpenAIRE - UsageCounts |  Contact Us";
30
  description = 'Any questions? Contact us ';
31
  title = 'OpenAIRE - UsageCounts |  Contact Us';
32 32
  subs: Subscription[] = [];
33
  
33 34
  constructor(private router: Router,
34 35
              private emailService: EmailService,
35 36
              private _title: Title, private _piwikService: PiwikService,
......
39 40
  
40 41
  ngOnInit() {
41 42
    this._title.setTitle(this.title);
42
    this._meta.updateTag({content: this.description}, "name='description'");
43
    this._meta.updateTag({content: this.description}, "property='og:description'");
44
    this._meta.updateTag({content: this.title}, "property='og:title'");
43
    this._meta.updateTag({content: this.description}, 'name=\'description\'');
44
    this._meta.updateTag({content: this.description}, 'property=\'og:description\'');
45
    this._meta.updateTag({content: this.title}, 'property=\'og:title\'');
45 46
    this._title.setTitle(this.title);
46 47
    let url = this.properties.domain + this.properties.baseLink + this.router.url;
47 48
    this.seoService.createLinkForCanonicalURL(url, false);
48
    this._meta.updateTag({content: url}, "property='og:url'");
49
    this._meta.updateTag({content: url}, 'property=\'og:url\'');
49 50
    if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
50 51
      this.subs.push(this._piwikService.trackView(this.properties, this.title).subscribe());
51
    }    this.email = {body: '', subject: '', recipients: []};
52
    }
53
    this.email = {body: '', subject: '', recipients: []};
52 54
    this.reset();
53 55
    this.showLoading = false;
54 56
  }
57
  
55 58
  public ngOnDestroy() {
56
    for (let sub of this.subs) {
57
      sub.unsubscribe();
58
    }
59
    this.subs.forEach(subscription => {
60
      if (subscription instanceof Subscriber) {
61
        subscription.unsubscribe();
62
      }
63
    });
59 64
  }
65
  
60 66
  public send(event) {
61 67
    HelperFunctions.scroll();
62 68
    if (event.valid === true) {

Also available in: Unified diff