We're building a cms driven application framework with Angular. We deliver multiple packages that can be used by customers to further customise the ui or logic. Components to that reason will delegate their logic to a service, with the intend customers can provide a custom service (we're avoiding component inheritance).
The components are dynamically being placed and are initialised with unique data set, holding the CMS data. The provided services will inherit this data from the component injector. This works great, however, when a custom service is provided (using InjectionToken
), we face 2 problems:
- The service is no longer a non-singleton, multiple component instances will be provided with the same custom service
- The service will no longer inherit the data value from the component as it's injected in a different scope
Anyone else got into a similar architectural challenge?