I know this seems like a dumb question but I got a scenario here.
I have a javascript file using three.js to render some models. This file requires a backend library but my WebGL rendering is in front end so I used Browsefiy to combine my own codes and the backend library to a single js file named script.js.
I want to trigger the init function in script.js file in my controller defined in controllers.js (the rendering only happens after the user clicks on some button). I understand that the controller of angularJs seems isolated with outside code but I couldn't find a good solution of my problem.
Since once I browsefied my code to include the backend library, it turns my 400 lines of rendering code into 2500+ lines of code and makes it impossible to write in a single controller.
Is there any good way to work around this? I will greatly appreciate any suggestion or ideas! Thanks!
<head>
<---This are the angular files I need->
<script src="./lib/angular/angular.min.js"></script>
<script src="./lib/angular-route/angular-route.min.js"></script>
<script src="./js/app.js"></script>
<script src="./js/controllers.js"></script>
<script src="./js/services.js"></script>
<--the followings are the rendering files I need-->
<script src="lib/third-party/threejs/three.min.js"></script>
<script src="lib/third-party/threejs/StereoEffect.js"></script>
<script src="lib/third-party/threejs/DeviceOrientationControls.js"></script>
<script src="lib/third-party/threejs/OrbitControls.js"></script>
<script src="./js/script.js"></script>
</head>
Update I posted my script.js. It is pretty long so that I hope I can work around by figuring out how to access the init function inside in a simple way. Thanks!