I use ng-route with ng-view for my client canvas drawing app. The drawing code is in a separated non-angular js file. I need to put
<div id="container"></div>
<p id="json"></p>
and
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsPlumb/1.4.1/jquery.jsPlumb-1.4.1-all.js"></script>
<script type="text/javascript" src="/public/canvas/projectTemplate.client.canvas.js"></script>
in the target ng-view.
The problem is, I can't add the scripts in the ng-view html file. (I dont see it on the browser debug window)
I have tried putting scripts
in the parent html file (which contains the ng-view
), and keep #container and #json
in the ng-view
(which i have to, because only this page needs these 2 elements), it has an error saying parentNode is not found
, because at that time, ng-view
(#container and #json
) has not been loaded, while the scripts
have been loaded
Edit:
I tried this on the subpage html:
<p id="p">this is text</p>
<script type="text/javascript">
(function() {
var p = document.getElementById('p')
p.innerText = 'changed by js'
})()
</script>
but it's not working