Add page.publitas_link for read PDF.

Nginx configuration for CORS https://www.industriapaisaia.eus
This commit is contained in:
Siroco 2018-10-05 18:16:19 +02:00
parent b95f6046c5
commit a535ed9a8e
2 changed files with 11 additions and 4 deletions

View File

@ -38,7 +38,7 @@
<section class="section-publitas"> <section class="section-publitas">
<div class="row" *ngIf="page.publitas_link"> <div class="row" *ngIf="page.publitas_link">
<div class="col-md-12"> <div class="col-md-12">
<simple-pdf-viewer #pdfViewer [src]="'../assets/'+page.publitas_link" [removePageBorders]="true"></simple-pdf-viewer> <simple-pdf-viewer #pdfViewer [src]="page.publitas_link" [removePageBorders]="true"></simple-pdf-viewer>
<div class="pdf-buttons" *ngIf="!pdfViewer.isDocumentLoaded()"> <div class="pdf-buttons" *ngIf="!pdfViewer.isDocumentLoaded()">
<button>Cargando documento</button> <button>Cargando documento</button>
</div> </div>

View File

@ -3,7 +3,7 @@ import { BrowserModule } from '@angular/platform-browser';
import { PageService } from '../page.service'; import { PageService } from '../page.service';
import { PageItem } from '../page'; import { PageItem } from '../page';
import { ActivatedRoute,Router, NavigationEnd } from "@angular/router"; import { ActivatedRoute,Router, NavigationEnd } from "@angular/router";
import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser'; import { SafeResourceUrl, DomSanitizer,SafeUrl } from '@angular/platform-browser';
import { import {
AccessibilityConfig, AccessibilityConfig,
Action, Action,
@ -34,7 +34,7 @@ import * as $ from 'jquery';
}) })
export class PageComponent implements OnInit { export class PageComponent implements OnInit {
pages : PageItem[]; pages : PageItem[] = [];
slug : string; slug : string;
parent : string; parent : string;
imageIndex = 1; imageIndex = 1;
@ -69,10 +69,17 @@ export class PageComponent implements OnInit {
} }
getPage() { getPage() {
console.log(this.slug); // console.log(this.slug);
this.pageService.getPage(this.slug) this.pageService.getPage(this.slug)
.subscribe(data => { .subscribe(data => {
this.pages = data; this.pages = data;
this.pages.forEach( (p) => {
var safeUrl:SafeUrl;
safeUrl = this.sanitizer.bypassSecurityTrustUrl('https://backend.industriapaisaia.eus/wp-content/uploads/2018/10/test.pdf');
p['publitas_link_sanitize'] = safeUrl;
console.log(p['publitas_link_sanitize']);
})
//console.log(data); //console.log(data);
}); });
} }