Skip to content

Commit 0fa0dcc

Browse files
committed
docs: update guides to support Angular 17
1 parent 2fc2a40 commit 0fa0dcc

File tree

4 files changed

+70
-11
lines changed

4 files changed

+70
-11
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ Check out our current openings and apply via [Stream's website](https://getstrea
5151

5252
### Install with NPM
5353

54+
Run the following command if you are using **Angular 17**
55+
56+
```shell
57+
npm install stream-chat-angular stream-chat @ngx-translate/core
58+
```
59+
5460
Run the following command if you are using **Angular 16**:
5561

5662
```shell
@@ -60,7 +66,7 @@ npm install stream-chat-angular stream-chat @ngx-translate/core
6066
Run the following command if you are using **Angular 15**:
6167

6268
```shell
63-
npm install stream-chat-angular stream-chat @ngx-translate/core@14
69+
npm install stream-chat-angular stream-chat @ngx-translate/core@14 ngx-popperjs@15
6470
```
6571

6672
Run the following command if you are using **Angular 14**:
@@ -72,13 +78,13 @@ npm install stream-chat-angular stream-chat @ngx-translate/core@14 ngx-popperjs@
7278
Run the following command if you are using **Angular 13**:
7379

7480
```shell
75-
npm install stream-chat-angular stream-chat @ngx-translate/core@13 [email protected] ngx-popperjs@13 --legacy-peer-deps
81+
npm install stream-chat-angular stream-chat @ngx-translate/core@14 [email protected] ngx-popperjs@13 --legacy-peer-deps
7682
```
7783

7884
Run this command if you are using **Angular 12**:
7985

8086
```shell
81-
npm install stream-chat-angular stream-chat @ngx-translate/core@13 [email protected] ngx-popperjs@12 --legacy-peer-deps
87+
npm install stream-chat-angular stream-chat @ngx-translate/core@14 [email protected] ngx-popperjs@12 --legacy-peer-deps
8288
```
8389

8490
## Sample App

docusaurus/docs/Angular/concepts/opt-in-architecture.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,30 @@ import {
3434
export class AppModule {}
3535
```
3636

37+
Or if you're using standalone components:
38+
39+
```typescript showLineNumbers={true} highlightedLines=8
40+
import { Component } from "@angular/core";
41+
import { TranslateModule } from "@ngx-translate/core";
42+
import {
43+
StreamAutocompleteTextareaModule,
44+
StreamChatModule,
45+
} from "stream-chat-angular";
46+
47+
@Component({
48+
selector: "app-root",
49+
standalone: true,
50+
imports: [
51+
TranslateModule,
52+
StreamAutocompleteTextareaModule,
53+
StreamChatModule,
54+
],
55+
templateUrl: "./app.component.html",
56+
styleUrls: ["./app.component.scss"],
57+
})
58+
export class AppComponent {}
59+
```
60+
3761
The chosen module decides what kind of `textarea` should be used in the message composer, you can choose between the [`AutocompleteTextareaComponent`](../components/AutocompleteTextareaComponent.mdx) with mentions or the [`TextareaComponent`](../components/TextareaComponent.mdx) that doesn't support mentions, but has a smaller bundle size. Your final application bundle will only include either the `TextareaComponent` or the `AutocompleteTextareaComponent`.
3862

3963
## Opt-in features

docusaurus/docs/Angular/concepts/translation.mdx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,45 @@ imports: [TranslateModule.forRoot(), StreamChatModule];
2424
export class AppModule {}
2525
```
2626

27+
Or if you're using standalone components:
28+
29+
```typescript
30+
import { ApplicationConfig, importProvidersFrom } from "@angular/core";
31+
import { TranslateModule } from "@ngx-translate/core";
32+
33+
export const appConfig: ApplicationConfig = {
34+
providers: [importProvidersFrom(TranslateModule.forRoot())],
35+
};
36+
```
37+
2738
:::important
2839
You should import the `TranslateModule.forRoot()` in a non-lazy loaded module (for example `AppModule`) even if the chat application is displayed from a lazy loaded module. If the translation isn't initialized properly the UI labels will be displayed as `"streamChat..."`.
2940
:::
3041

42+
If you're using standalone components, make sure to also import the `TranslateModule` to the component that displays the chat UI:
43+
44+
```typescript
45+
import { Component } from "@angular/core";
46+
import { TranslateModule } from "@ngx-translate/core";
47+
import {
48+
StreamAutocompleteTextareaModule,
49+
StreamChatModule,
50+
} from "stream-chat-angular";
51+
52+
@Component({
53+
selector: "app-root",
54+
standalone: true,
55+
imports: [
56+
TranslateModule,
57+
StreamAutocompleteTextareaModule,
58+
StreamChatModule,
59+
],
60+
templateUrl: "./app.component.html",
61+
styleUrls: ["./app.component.scss"],
62+
})
63+
export class AppComponent {}
64+
```
65+
3166
### Set up the translations
3267

3368
Initialize the translation in the **constructor** of the component which displays the chat UI (for example `AppComponent`)
@@ -48,14 +83,7 @@ It's important to call the `setTranslation` in the constructor of the component
4883

4984
### Module import
5085

51-
If you are already using ngx-translate in your project, we suppose you already have it installed and the `TranslateModule` is configured and imported. You just have to import the `StreamChatModule`:
52-
53-
```typescript
54-
import { StreamChatModule } from "stream-chat-angular";
55-
56-
imports: [StreamChatModule];
57-
export class AppModule {}
58-
```
86+
If you are already using ngx-translate in your project, you already have the `TranslateModule` imported and configured in your project, so you **don't** need to import `TranslateModule.forRoot()`. However you still need to import `TranslateModule` (**without** the `forRoot`) to the module/standalone component that displays the chat UI to access the `translate` pipe.
5987

6088
### Register the translations
6189

projects/stream-chat-angular/src/lib/chat-client.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export class ChatClientService<
8989
* @param userOrId you can emit this for anonymous logins
9090
* @param userTokenOrProvider You can provide:<ul>
9191
* <li> a token, </li>
92+
* <li> a token provider, a method that returns `Promise<string>`, which can be called when the previous token expires (recommended setup for production applications)</li>
9293
* <li> the keyword 'guest' to connect as [guest user](https://getstream.io/chat/docs/javascript/authless_users/?language=javascript#guest-users) </li>
9394
* <li> the keyword 'anonymous' to connect as [anonymous user](https://getstream.io/chat/docs/javascript/authless_users/?language=javascript#anonymous-users) </li>
9495
* </ul>

0 commit comments

Comments
 (0)