import { Component , Input , OnInit } from '@angular/core' ; import { BehaviorSubject } from 'rxjs' ; import { FileElement } from '../../model/file-element' ; import { FileService } from '../../service/file.service' ; @ Component ( { selector : 'cmdb-folder-path-viewer' , templateUrl : './folder-path-viewer.component.html' , styleUrls : [ './folder-path-viewer.component.scss' ] } ) export class FolderPathViewerComponent implements OnInit { public pathViewer : string [ ] = [ ] ; private selectedFileElement : any ; @ Input ( ) folderTree : FileElement [ ] = [ ] ; @ Input ( ) set selectedFileFolder ( value ) { this . selectedFileElement = value ; } get selectedFileFolder ( ) : BehaviorSubject < any > { return this . selectedFileElement ; } constructor ( private fileService ) { } public ngOnInit ( ) { this . selectedFileFolder . subscribe ( folder => { if ( folder ) { this . pathViewer = this . fileService . pathBuilder ( folder . public_id , [ ] , this . folderTree ) ; } } ) ; } }