Reputation: 2597
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:
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?
If so, how would one go about 'rewriting' the JS scripts into an angular friendly context?
re there any limitations or restrictions when using server-side languages?
Upvotes: 8
Views: 635
Reputation: 2337
The usual good practice is to wrap existing regular JS module/script with some angular bindings. Usually it's being done by creating angular service or factory or components/directives (in case of scripts modifying DOM as rightly noted by Dan Pantry) that are responsible for injecting non angular functionality to angular modules. However wrapping more complex DOM modifying modules in components might be more demanding as it may require to implement all the angular way of dealing with DOM modifications.
You can find examples on the web. I.e. here is similar question answered. Here is some step by step and here is another interesting reading concerning using third party libraries with angular.
Also as for particular no-angular js modules I would either look for any existing angularized versions or maybe any similar library having angular API.
There are no any limitations as for server side languages.
Upvotes: 3
Reputation: 17487
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.
Upvotes: 5
Reputation: 944445
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.
Upvotes: 8