Skip to content

Commit 012ce9d

Browse files
committed
(docs) add angular setup
1 parent d0a4dcd commit 012ce9d

File tree

1 file changed

+47
-19
lines changed

1 file changed

+47
-19
lines changed

README.md

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -700,37 +700,65 @@ messages: {
700700

701701
## Use as a Web Component
702702

703-
### Clone vue-advance-chat project
703+
### Install vue-advance-chat component
704704

705-
```bash
706-
git clone https://github.com/antoine92190/vue-advanced-chat.git
707-
```
705+
- Follow [Installation](#installation) steps
708706

709-
### Build it as a Web Component
707+
### Install Vue.js
710708

711709
```bash
712-
npm i && npm run build:wc
713-
```
714-
715-
### Add Vue.js to your application
710+
# Using npm
711+
npm install --save vue
716712

717-
```html
718-
<!-- index.html -->
719-
<script src="https://unpkg.com/vue"></script>
713+
# Using yarn
714+
yarn add --save vue
720715
```
721716

722-
### Import the built minified component in your application
717+
### Angular Setup
723718

724-
#### Add vue-advanced-chat.min.js in your application files
719+
```json
720+
// angular.json
725721

726-
```
727-
vue-advanced-chat/dist/vue-advanced-chat.min.js
728-
```
722+
"build": {
723+
...
729724

730-
#### Import the vue-advanced-chat.min.js file you just added
725+
"scripts": [
726+
"./node_modules/vue/dist/vue.min.js",
727+
"./node_modules/vue-advanced-chat/dist/vue-advanced-chat.min.js"
728+
]
729+
}
730+
```
731731

732732
```javascript
733-
import './vue-advanced-chat.min.js'
733+
// page.module.ts
734+
735+
@NgModule({
736+
...
737+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
738+
})
739+
```
740+
741+
```html
742+
<!-- page.html -->
743+
744+
<vue-advanced-chat
745+
height="100vh"
746+
[currentUserId]="currentUserId"
747+
[roomId]="roomId"
748+
[rooms]="rooms"
749+
[roomsLoaded]="true"
750+
[messages]="messages"
751+
[messagesLoaded]="messagesLoaded"
752+
[showFiles]="true"
753+
[showEmojis]="true"
754+
[textFormatting]="true"
755+
[showReactionEmojis]="true"
756+
[showFooter]="true"
757+
(fetch-messages)="fetchMessages($event.detail[0])"
758+
(send-message)="sendMessage($event.detail[0])"
759+
...
760+
>
761+
</vue-advanced-chat>
734762
```
735763

736764
<br>

0 commit comments

Comments
 (0)