Project

General

Profile

1
import {Component, Input} from '@angular/core';
2
import {Observable}       from 'rxjs/Observable';
3
import {ActivatedRoute, Router} from '@angular/router';
4
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
5

    
6
@Component({
7
    selector: 'openaire-directLinking',
8
    template: `<directLinking [communityId]=communityId></directLinking>`
9
})
10
export class OpenaireDirectLinkingComponent {
11
  communityId:string;
12
  constructor (
13
      private route: ActivatedRoute,
14
      private _router: Router
15

    
16
      ) {
17
        this.route.queryParams.subscribe(
18
          communityId => {
19
                this.communityId = communityId['communityId'];
20
                 if(!this.communityId && typeof document !== 'undefined'){
21
                  this.communityId  = ConnectHelper.getCommunityFromDomain(document.location.hostname);
22
                 }
23

    
24
              });
25

    
26
      }
27
}
(2-2/3)