angular-plugin-architecture
angular-plugin-architecture copied to clipboard
Sharing service between App and plugins
Your work is amazing. (I've already search for such plugin system without finding a really good architecture.)
I'm relatively new to angular, and I don't master enough depecndencies injection with your example.
I just would like to go further than sharing components with plugins. What I want is to share a service (so my plugins could interact with app; it two ways : having methods to call app features; or being notified from app).
Here are headline of what I would like to do :
The serviceInterface :
export interface ISharedService{
//the Obersable/event the plugin can register/subscribe to
notificationEvent: Observable<string>;
//a method call by plugins and executed on app
doSometing(): void;
}
A plugin example:
constructor(private sharedService: ISharedService) {
this.sharedService.notificationEvent.subscribe( message => {
});
}
The service must be implemented on app side
Could it be realizable by the plugin architecture ? I've tried without success, but my skills are limited on such project (I've tested with the branch share-lib-between-app-and-plugins)