UPDATE
I am thinking of using the following solution, is this a good way?
I am working on a project that is being ported from wordpress to angularJS (will have later on its own backend). Some of the required javascript files that were already there must remain.
I am using angular ui router to keep the same routes that were there before, with states as the library requires.
Here is my issue, I have the following files loaded in the main 'index.html':
<script type='text/javascript' src='/wp-content/themes/twentyfourteen-child/assets/js/bootstrap.min0c54.js?ver=150923'></script>
<script type='text/javascript' src='/wp-content/themes/twentyfourteen-child/assets/js/svg-injector-min5b31.js?ver=4.3.1'></script>
<script type='text/javascript' src='/wp-content/themes/twentyfourteen-child/assets/js/bootstrap-select.min0c54.js?ver=150923'></script>
<script type='text/javascript' src='/wp-content/themes/twentyfourteen-child/assets/js/jquery.matchHeight.min0c54.js?ver=150923'></script>
<script type='text/javascript' src='/wp-content/themes/twentyfourteen-child/assets/js/imgw-mina8b3.js?ver=150526'></script>
<script type='text/javascript-lazy' src='/wp-content/themes/twentyfourteen-child/assets/js/jquery-cycle2.min0c54.js?ver=150923'></script>
<script type='text/javascript-lazy' src='/wp-content/themes/twentyfourteen-child/assets/js/scrollTo.min0c54.js?ver=150923'></script>
<script type='text/javascript-lazy' src='/wp-content/themes/twentyfourteen-child/assets/js/imgw_home_scripts-min0c54.js?ver=150923'></script>
These files are required. Now when I route to a specific url, say for example:
/a-new-url
which points to template:
/partial/a-new-url.html
So for example this template has a carousel that uses one of these javascript files, however the carousel doesn't work anymore unless i copy and paste the script tags inside the partial . Now this is a bad solution and will cause redundancy since i will have to do that with each different partial.
What is the correct way to handle and fix this issue?
Code for carousel (as requested)
in index.html have the following files in body tag:
<script type='text/javascript-lazy' src='/wp-content/themes/twentyfourteen-child/assets/js/jquery-cycle2.min0c54.js?ver=150923'></script>
<script type='text/javascript-lazy' src='/wp-content/themes/twentyfourteen-child/assets/js/scrollTo.min0c54.js?ver=150923'></script>
<script type='text/javascript-lazy' src='/wp-content/themes/twentyfourteen-child/assets/js/imgw_home_scripts-min0c54.js?ver=150923'></script>
My investigation shows that this html is what loads it automatically based on "id=home-slideshow"
<div id="home-slideshow">
<div id="slides" class="home-slider">
<div class="slide" style="background-image: url(/wp-content/uploads/2014/05/home.jpg);">
</div>
<div class="slide" style="background-image: url(/wp-content/uploads/2014/05/1170780.jpg);">
</div>
<div class="slide" style="background-image: url(/wp-content/uploads/2014/05/ep.jpg);">
</div>
</div>
</div>