Hello,
Alfresco Angular 2 Components Catalog describes how you can set the default folder for the document-list dynamically. This is the snippet from the website:
import { ChangeDetectorRef } from '@angular/core';
import { AlfrescoApiService } from 'ng2-alfresco-core';
export class FilesComponent implements OnInit {
currentFolderId: string = '-my-';
constructor(private apiService: AlfrescoApiService,
private changeDetector: ChangeDetectorRef) {
// ...
}
ngOnInit() {
let nodes: any = this.apiService.getInstance().nodes;
nodes.getNodeInfo('-root-', {
includeSource: true,
include: ['path', 'properties'],
relativePath: '/Sites/swsdp/documentLibrary'
})
.then(node => {
console.log(node);
this.currentFolderId = node.id;
this.changeDetector.detectChanges();
});
}
}I've tested it on 1.7.0 and it only works when running the angular app on my local machine. As soon as I deploy it on a remote testserver (still intranet) it sometimes, but not always, doesn't show the desired folder specified by relativePath, but navigates to the path currentFolderId initially was set to. In this case -my-.
Changing
currentFolderId: string = '-my-';
to
currentFolderId: string;
solves the problem for me but I don't know if this is really the right technique or if I was just lucky.