mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
* routed viewer (demo app) * toolbar support * app menu component for demo shell * navigate back button * fix unit tests * improve viewer type detection and rendering * download button * automatic pdf rendition, spinners, ui tweaks * border for pdf pages * scroll top support * docs update * info drawer placeholder
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
|
|
|
@Component({
|
|
selector: 'adf-file-view',
|
|
templateUrl: 'file-view.component.html'
|
|
})
|
|
export class FileViewComponent implements OnInit {
|
|
|
|
nodeId: string = null;
|
|
|
|
constructor(
|
|
private router: Router,
|
|
private route: ActivatedRoute,
|
|
private apiService: AlfrescoApiService) {}
|
|
|
|
ngOnInit() {
|
|
this.route.params.subscribe(params => {
|
|
const id = params.nodeId;
|
|
if (id) {
|
|
this.apiService.getInstance().nodes.getNodeInfo(id).then(
|
|
(node) => {
|
|
if (node && node.isFile) {
|
|
this.nodeId = id;
|
|
return;
|
|
}
|
|
this.router.navigate(['/files', id]);
|
|
},
|
|
() => this.router.navigate(['/files', id])
|
|
);
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|