Is it safe to import custom .js files, and Jquery library ?

14 views
Skip to first unread message

kapil Budhiraja

unread,
Jul 18, 2017, 10:03:20 PM7/18/17
to Angular and AngularJS discussion
Hello All,

I'm writing an web application using Angular 4, and would like to know if it's safe to load a JavaScript file to connect to socketIO for emitting and listening on responses ?
Also, I want to use jQuery for dataTables features such as filter, export, search etc

I would love to hear your opinion on my concern :)



Kapil

Sander Elias

unread,
Jul 19, 2017, 1:06:58 AM7/19/17
to Angular and AngularJS discussion
Hi Kapil,

Technically, Angular play's nice with whatever you load in the browser. That includes jQuery. However, jQuery (and its plugins) uses the DOM as its source of truth, and angular uses your data, and sees the DOM as a means of output. This difference will make your life much harder as it needs to be. There are good angular version 4 and up datatables available.

Regards
Sander

Zlatko Đurić

unread,
Jul 19, 2017, 2:49:51 AM7/19/17
to Angular and AngularJS discussion

On Wednesday, July 19, 2017 at 4:03:20 AM UTC+2, kapil Budhiraja wrote:

I'm writing an web application using Angular 4, and would like to know if it's safe to load a JavaScript file to connect to socketIO for emitting and listening on responses ?
Also, I want to use jQuery for dataTables features such as filter, export, search etc


I would avoid jQuery (or anything external) for table manipulation, unless you want to offload the whole thing to the 3rd party lib. As Sander says, there are pretty awesome implementations of data tables for Angular 2+, just an npm search away. You find something you like, and if you expect you're going to go crazy with your demands, you can always do pull requests with whatever feature you need, or fork your own.

But even for basic tables it's simple to filter stuff out. That is one of the things that pushed Angular so hard, this binding between the DOM and your data. So you always operate on your data, and Angular works out the rest.
Reply all
Reply to author
Forward
0 new messages