Skip to content

Commit 7a45362

Browse files
committed
chore: update README for standalone app specific instructions
1 parent 4d7bdf2 commit 7a45362

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

README.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ImageKit is complete media storage, optimization, and transformation solution th
2121

2222
2. **API parameter changes**
2323
- The `path` parameter has been renamed to `src` in `ik-image` and `ik-video` components
24-
- The `publicKey` parameter has been removed from component-level usage.
24+
- The `publicKey` parameter has been removed from the configuration provider
2525
- New: `<ik-image src="/default-image.jpg"></ik-image>`
2626

2727
3. **LQIP feature removed**
@@ -111,9 +111,15 @@ Please note that this SDK version supports `Angular version 9 and onwards`. For
111111

112112
### Initialization
113113

114-
To use the SDK, you need to provide it with a few configuration parameters. The configuration parameters must be passed to the `ImagekitioAngularModule` module in your `app.module.ts` file. example:
114+
The SDK supports both **module-based** and **standalone** Angular applications.
115+
116+
#### Module-based Applications
117+
118+
To use the SDK in a module-based app, import `ImagekitioAngularModule` in your `app.module.ts`:
119+
120+
```typescript
121+
import { ImagekitioAngularModule } from '@imagekit/angular';
115122

116-
```js
117123
@NgModule({
118124
declarations: [
119125
AppComponent
@@ -122,17 +128,35 @@ To use the SDK, you need to provide it with a few configuration parameters. The
122128
BrowserModule,
123129
AppRoutingModule,
124130
ImagekitioAngularModule.forRoot({
125-
publicKey: environment.publicKey,
126131
urlEndpoint: environment.urlEndpoint,
127132
})
128133
],
129134
providers: [],
130135
bootstrap: [AppComponent]
131136
})
137+
export class AppModule { }
132138
```
133139

140+
#### Standalone Applications (Angular 14+)
141+
142+
For standalone Angular applications, use the `provideImageKit` function in your `app.config.ts`:
143+
144+
```typescript
145+
import { ApplicationConfig } from '@angular/core';
146+
import { provideImageKit } from '@imagekit/angular';
147+
148+
export const appConfig: ApplicationConfig = {
149+
providers: [
150+
provideImageKit({
151+
urlEndpoint: environment.urlEndpoint,
152+
})
153+
]
154+
};
155+
```
156+
157+
#### Configuration Options
158+
134159
* `urlEndpoint` is required to use the SDK. You can get URL-endpoint from your ImageKit dashboard - https://imagekit.io/dashboard/url-endpoints.
135-
* `publicKey` and `authenticator` parameters are required if you want to use the SDK for client-side file upload. You can get `publicKey` from the developer section in your ImageKit dashboard - https://imagekit.io/dashboard/developer/api-keys.
136160
* `transformationPosition` is optional. The default value for the parameter is `query`. Acceptable values are `path` & `query`
137161

138162
> Note: Do not include your [private key](https://docs.imagekit.io/api-reference/api-introduction/api-keys#private-key) in any client-side code.
@@ -679,14 +703,8 @@ The SDK re-exports the some of the core ImageKit JavaScript SDK methods, giving
679703
```js
680704
import { buildSrc } from '@imagekit/angular';
681705
...
682-
// Initializing the service with configuration
683-
service = new ImagekitService({
684-
urlEndpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/",
685-
publicKey: "your_public_key",
686-
});
687706

688707
// Generating URL
689-
// Note: You can choose to override the publicKey if necessary
690708
const url = buildSrc({
691709
src: "/default-image.jpg",
692710
urlEndpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/",

0 commit comments

Comments
 (0)