Skip to content

Commit cdda666

Browse files
authored
Merge pull request #375 from GetStream/pin-message-docs
docs: Extend pin message code example with unpin
2 parents f5aaa4c + 57bb16d commit cdda666

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docusaurus/docs/Angular/code-examples/pin-messages.mdx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,31 @@ jumpToMessage(message: StreamMessage) {
7373
{{ message.text }}
7474
</div>
7575
```
76+
77+
## Unpin message
78+
79+
Let's extend our example and add an Unpin button to remove the pin from a message.
80+
81+
```typescript
82+
unpinMessage(message: StreamMessage<DefaultStreamChatGenerics>) {
83+
this.channelService.unpinMessage(message);
84+
}
85+
```
86+
87+
```html
88+
<div
89+
style="padding: 8px; background: #e1f5fe"
90+
*ngFor="
91+
let message of channelService.activeChannelPinnedMessages$ | async
92+
"
93+
(click)="jumpToMessage(message)"
94+
>
95+
{{ message.text }}
96+
<button
97+
style="border: none; background: none; padding: 0; margin: 0"
98+
(click)="$event.stopPropagation(); unpinMessage(message)"
99+
>
100+
Unpin
101+
</button>
102+
</div>
103+
```

0 commit comments

Comments
 (0)