Hi, @manfredsteyer hope you can explain some things about this library.
facade should be in the feature-component providers? because I can see each feature created with the facade, should the facade be co-responsive to the component life cycle and destroyed when the component is destroyed?
only facades are allowed to export from domain lib?
facades should expose other services, and the component can't have access to those services?
this code it's how it's should be?
@Component({})
export class Component {
facade = inject(facade);
vm = facade.vm;
ngOnInit() { this.facade.loadData() };
}
@Injectable({ provideIn: 'root')
export class Facade {
vm = new BehaviorSubject(..);
loadData = this.fooService.loadData;
}
@Injectable({ provideIn: 'root')
export class FooService {
vm = new BehaviorSubject(..);
api = inject(ApiService);
loadData() {
return this.api.getData();
}
}
domain/index.ts
export from './facade1';
export from './facade2';
export * from './facade3';
- all the logic in the facade? Does it mean that no functions allow in the component?
Hi, @manfredsteyer hope you can explain some things about this library.
this code it's how it's should be?
@Injectable({ provideIn: 'root') export class Facade { vm = new BehaviorSubject(..); loadData = this.fooService.loadData;
}
@Injectable({ provideIn: 'root') export class FooService { vm = new BehaviorSubject(..); api = inject(ApiService);
loadData() { return this.api.getData(); } }
domain/index.ts export from './facade1'; export from './facade2'; export * from './facade3';