Skip to content

Commit 225d0d7

Browse files
committed
chore: Update README for standalone components. Fixes #188
1 parent ad07897 commit 225d0d7

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,38 @@ In your app.component.html, simply add:
8787
```xml
8888
<ng-http-loader></ng-http-loader>
8989
```
90+
## Standalone components
9091

92+
If you prefer using standalone components, you should configure your `ApplicationConfig` like following
93+
94+
```typescript
95+
export const appConfig: ApplicationConfig = {
96+
providers: [
97+
provideRouter(routes),
98+
provideHttpClient(
99+
withInterceptorsFromDi() // <== Don't forget to import the interceptors
100+
),
101+
importProvidersFrom(NgHttpLoaderModule.forRoot()) //<== Always call `forRoot`
102+
],
103+
};
104+
```
105+
Then you can use `ng-http-loader` like this
106+
```typescript
107+
import { Component } from '@angular/core';
108+
import {NgHttpLoaderModule} from "ng-http-loader";
109+
110+
@Component({
111+
selector: 'my-selector',
112+
standalone: true,
113+
imports: [
114+
NgHttpLoaderModule
115+
],
116+
template: `
117+
<ng-http-loader />`,
118+
})
119+
export class InlineComponent {
120+
}
121+
```
91122
## Customizing the spinner
92123

93124
You can customize the following parameters:

0 commit comments

Comments
 (0)