Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I include regular JS (non-jQuery) in my Angular app?

I am new to angular and I know that its a good idea for new-comers to forget that jQuery exists when writing an angular application because in short with a jQuery application you design a page, and then you make it dynamic but with angular you literally build it from the ground up, therefore, conflicts can occur.

I have a few questions:

  1. Does this 'rule' also apply for regular JS scripts? for example: For an rss feed can I use jquery-rss.js to include rss functionality in the view or do would I need to rewrite in an angular context and use it in a controller? Or one more example: If I am using bootstrap.min.css can I use bootstrap.min.js?

  2. If so, how would one go about 'rewriting' the JS scripts into an angular friendly context?

  3. re there any limitations or restrictions when using server-side languages?

like image 899
AnonDCX Avatar asked Mar 07 '16 10:03

AnonDCX


2 Answers

Does this 'rule' also apply for regular JS scripts?

Yes, anything which manipulates the DOM risks stepping on Angular's toes and being harder to implement / maintain.

Also are there any limitations or restrictions when using server-side languages?

No. The client has no idea what generates the data it gets from the server.

like image 72
Quentin Avatar answered Oct 21 '22 08:10

Quentin


For the particular case of Bootstrap, the recommended way is to use UI Bootstrap (made by the Angular UI team) which "angularizes" most of the Twitter Bootstrap interactive components as Angular directives.

You still use Bootstrap's CSS but the interactive part is made in Angular.

like image 5
Pierre Henry Avatar answered Oct 21 '22 08:10

Pierre Henry