Skip to content
Permalink
edae4c02b0
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
32 lines (27 sloc) 1009 Bytes
import { Component, OnInit } from '@angular/core';
import { ResourceService } from './services/api/resource.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
title = 'SystemNavigationFrontend';
constructor(
private resourceService: ResourceService
) {}
ngOnInit() {
// Example usage of resource service.
this.resourceService.getResourceStandard('test.txt', 'text').toPromise().then(val => console.log('Test file', val))
.catch(err => console.log(err));
this.resourceService.getResourcePDF('radar.pdf').toPromise().then(val => {
console.log('Radar pdf', val);
const file = new Blob([val], { type: 'application/pdf' });
const url = URL.createObjectURL(file);
console.log('PDF Viewable at', url);
console.log('Adblock prevents it from opening');
// window.open(url);
})
.catch(err => console.log(err));
}
}