Smart Viewer Registry
The Smart Toolbar Registry provides an easy way to obtain a reference to a Smart Viewer Component, without the need for it to be a direct view child.
import { SmartComponentLibraryModule, SmartFormComponent, CustomSmartForm, DataSourceRegistry, SmartViewerRegistryService, SmartTabFolderRegistryService, SmartViewManagerService, SmartFormInstanceService, SmartToolbarRegistry, SmartRouteGuard, SmartViewerComponent } from '@consultingwerk/smartcomponent-library';
import { Component, Injector, OnInit, OnDestroy, OnChanges, SimpleChanges, NgModule } from '@angular/core'
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
@CustomSmartForm('myForm')
@Component({
selector: 'security-object-maintenance-form',
templateUrl: '../../../../node_modules/@consultingwerk/smartcomponent-library/ui/form/smart-form.component.html',
viewProviders: [DataSourceRegistry, SmartViewManagerService, SmartFormInstanceService, SmartToolbarRegistry, SmartViewerRegistryService, SmartTabFolderRegistryService]
})
export class SecurityObjectMaintenanceFormComponent extends SmartFormComponent implements OnInit, OnDestroy, OnChanges {
constructor(injector: Injector,
private viewerRegistry: SmartViewerRegistryService) {
super(injector);
}
ngOnInit() {
// Add your own initialization logic here
this.setFormConfiguration('frontend://assets/security-object-maintenance.layout.json');
super.ngOnInit();
this.viewerRegistry
.getSmartViewer('MyViewer')
.subscribe((viewerInstance: SmartViewerComponent) => {
// use the Smart Viewer Instance here
})
}
ngOnDestroy() {
super.ngOnDestroy();
}
ngOnChanges(changes: SimpleChanges) {
super.ngOnChanges(changes);
}
}