mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-20 05:02:37 +08:00
fix(angular): provideHttpClient when HttpClientModule is present in the imports array
This commit is contained in:
parent
b015e7dca7
commit
1390642f10
@ -1,5 +1,6 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, InjectionToken, NgModule, Provider } from '@angular/core';
|
||||
import { HttpClientModule, provideHttpClient } from '@angular/common/http';
|
||||
import { InjectionToken, NgModule, Provider } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import {
|
||||
BrowserAnimationsModule,
|
||||
@ -41,6 +42,13 @@ const analyzeRestricted = (ngModule: NgModule) => {
|
||||
return [true, provideNoopAnimations()];
|
||||
}
|
||||
|
||||
/**
|
||||
* HttpClient has to be provided manually as a singleton
|
||||
*/
|
||||
if (ngModule === HttpClientModule) {
|
||||
return [true, provideHttpClient()];
|
||||
}
|
||||
|
||||
return [false];
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user