Atif Javed
Atif Javed

Reputation: 133

Sails Socket with Angular 5

I am developing an application with a sails backend and Angular 5 as the front end app.

I need to use the sails socket feature with the Angular 5 based app. I added a script tag which is

<script type="text/javascript" src="http://localhost:1337/js/dependencies/sails.io.js"></script>

But when I run the ng serv and then the console shows this error. Thanks in advance.

Console Error Image

Upvotes: 1

Views: 844

Answers (1)

Sangwin Gawande
Sangwin Gawande

Reputation: 8166

Create a folder js in your Angular 5 /src/assets/ directory.

Put the sails.io.js file in your Angular 5 /src/assets/js/ folder.

Now in your index.html give path like follow:

<script type="text/javascript" src="assets/js/sails.io.js"></script>

It will work fine.

Upvotes: 1

Related Questions