Project

General

Profile

1
import {Component, Input}         from '@angular/core';
2
import {Location}                 from '@angular/common';
3
import {ActivatedRoute}           from '@angular/router';
4
import {Title, Meta}              from '@angular/platform-browser';
5

    
6
@Component({
7
    selector: 'error',
8
    template: `
9
    <div id="tm-main" class=" uk-section  uk-margin-small-top tm-middle">
10
      <div uk-grid uk-grid>
11
       <div class="tm-main uk-width-1-1@s uk-width-1-1@m  uk-width-1-1@l uk-row-first ">
12
        <div class="uk-container">
13
            <h2>
14
                Bad karma: we can't find that page!
15
            </h2>
16
            <br>
17
            <p>
18
                You asked for {{page}}, but despite our computers looking very hard, we could not find it. What happened ?
19
            </p>
20
            <ul>
21
                <li>the link you clicked to arrive here has a typo in it</li>
22
                <li>or somehow we removed that page, or gave it another name</li>
23
                <li>or, quite unlikely for sure, maybe you typed it yourself and there was a little mistake ?</li>
24
            </ul>
25
        </div>
26
      </div>
27
     </div>
28
  </div>
29
    `
30
})
31

    
32
export class ErrorPageComponent {
33
    public page: string;
34

    
35
    constructor (private _location: Location, private _meta: Meta,
36
                 private _title: Title, private route: ActivatedRoute) {
37

    
38
        var title = "OpenAIRE | Error page";
39

    
40
        this._meta.updateTag({content:title},"property='og:title'");
41
        this._title.setTitle(title);
42
        this.page = _location.path(true);
43
        //this.page = _router.url;
44
        //this.page = location.href;
45
    }
46
    ngOnInit() {
47
         this.route.queryParams.subscribe(data => {
48
            this.page = data['page'];
49
            if (!this.page) {
50
              this.page = this._location.path(true);
51
            }
52
          });
53
    }
54
}
(2-2/3)