UNPKG

1.96 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var __metadata = (this && this.__metadata) || function (k, v) {
9 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10};
11var core_1 = require('@angular/core');
12var common_1 = require('@angular/common');
13var ImproveThisDocLink = (function () {
14 function ImproveThisDocLink(el, renderer, location) {
15 this.el = el;
16 this.renderer = renderer;
17 this.location = location;
18 }
19 ImproveThisDocLink.prototype.getPath = function (path) {
20 return path.replace(this.location.getBaseHref(), '/');
21 };
22 ImproveThisDocLink.prototype.ngOnInit = function () {
23 this.renderer.setElementAttribute(this.el.nativeElement, 'href', this.staticRepo + this.getPath(this.location.path()) + '.html');
24 };
25 __decorate([
26 core_1.Input('improveThisDocLink'),
27 __metadata('design:type', String)
28 ], ImproveThisDocLink.prototype, "staticRepo", void 0);
29 ImproveThisDocLink = __decorate([
30 core_1.Directive({
31 selector: '[improveThisDocLink]'
32 }),
33 core_1.Injectable(),
34 __metadata('design:paramtypes', [core_1.ElementRef, core_1.Renderer, common_1.LocationStrategy])
35 ], ImproveThisDocLink);
36 return ImproveThisDocLink;
37}());
38exports.ImproveThisDocLink = ImproveThisDocLink;
39//# sourceMappingURL=improve-this-doc.directive.js.map
\No newline at end of file