Creating an Angular Document Editor Application with a Node.js WebSocket Server
This tutorial shows how to create an Angular application that uses the Document Editor with a Node.js WebSocket server.

The npm package for using the document editor in Angular applications can be used with an ASP.NET (Core) backend or a Node.js server to handle the WebSocket requests. This tutorial will show you how to create an Angular application that uses a Node.js backend server to handle the requests.
Creating the Node.js Project
Prerequisites
-
Install Node.js® and npm, if not done before.
-
Open a Node.js command prompt, create an empty folder called "node-websocket-server", navigate into and type in the following command to install the document editor:
npm install @txtextcontrol/tx-websocket-server
-
Type in the following command to install Express, the minimalist web framework for node:
npm install express
-
Create a new file named main.js in the project's root folder, copy the following code into this JavaScript file and save it:
const { WebSocketServer } = require('@txtextcontrol/tx-websocket-server'); const express = require('express'); const app = express(); const server = app.listen(8080); var wsServer = new WebSocketServer(server);
-
Back in the command prompt, start the Node.js application by typing in the following command:
node main.js
Creating the Angular Application
Prerequisites
-
Open a Command Prompt and install the Angular CLI globally by typing in the following command:
npm install -g @angular/cli
-
Open a Command Prompt and create a new project and default app by typing in the following command:
ng new my-editor-app
Follow the questions in the command prompt by answering them with "y" to add Angular routing and Enter to confirm CSS as your preferred stylesheet format.
-
Change into the created folder by typing in the following command:
cd my-editor-app
-
Install the TX Text Control document editor package by typing in the following command:
ng add @txtextcontrol/tx-ng-document-editor
Supported Angular Versions
Are you getting an error similar to this?
ERESOLVE unable to resolve dependency tree
You have two options here:
-
Please check the supported Angular versions of tx-ng-document-editor and downgrade Angular and the global Angular CLI version to a version that will satisfy the requirement.
-
Force the installation of the package. Read more about that here:
Document Editor and Viewer with Newer Versions of Angular CLI
-
-
Open this folder in Visual Studio Code by typing in the following command:
code .
-
In Visual Studio Code, open the file src -> app -> app.component.html, add replace the complete content with the following code and save it:
<tx-document-editor width="1000px" height="500px" webSocketURL="ws://localhost:8080/TXWebSocket"> </tx-document-editor>
Backend Server
In the code above, we are using the Node.js backend that we created in the first step. If you have been using a different port and endpoint path, you should replace them.
-
Back in the command prompt, start the Angular application by typing in the following command:
ng serve --open
Angular
Integrate document processing, editing, sharing, collaboration, creation, electronic signatures, and PDF generation into your Angular Web applications.
Related Posts
Creating a WebSocket Server Project with Node.js
This article shows how to create the required WebSocket server project for Angular applications using Node.js.
Angular: Loading and Saving Local Documents
This article shows how to load and save local documents using the Angular version of the document editor.
Reuse Persistent Document Editor Components in Angular SPA Applications
An Angular Single Page Application (SPA) dynamically updates the web page without reloading by loading all necessary resources once. This article demonstrates how to reuse persistent Document…
Building an ASP.NET Core Backend (Linux and Windows) for the Document Editor…
This article shows how to create a backend for the Document Editor and Viewer using ASP.NET Core. The backend can be hosted on Windows and Linux and can be used in Blazor, Angular, JavaScript, and…
AngularJavaScriptDocument Editor
Getting Started: Document Editor Version 33.0 with Angular CLI 19.0
This article shows how to use the TX Text Control Document Editor version 33.0 npm package for Angular within an Angular CLI 19.0 application. It uses the trial backend running on our servers, but…