Let's say you have a component providers.
@Component({
selector: "app-button",
template: `...`,
providers: [QueryService]
})
You can override the component provider by passing componentProviders
.
const createHost = createHostComponentFactory<ZippyComponent>({
component: ZippyComponent,
componentProviders: [
{ provide: QueryService, useValue: {} }
]
});
Get the component provider:
host = createHost(`<app-button>Click</app-button>`);
const queryService = host.get<QueryService>(QueryService, true);