javascript - ng-include wont load script nested in inlcuded html -
i´m trying include html page ng-include directive div in main html.
main html:
<div class="col-sm-9" data-ng-include="'subpage.html'"> </div>
this subpage displayed correclty in given div. additionaly subpage contains script contains angular methods. added in header of subpage.
<script type="text/javascript" src="js/subservice.js"></script>
calling page
localhost:8080/subpage
allowes me use functions , linked functions controller.
but when included via ng-include script not load ofc results in no functionality. (checked in console)
both mainpage , subpage contain ng-app directive , both full standalone html.
does have idea how this?
update
like said in answers
<object name="subpage" type="text/html" data="./subpage.html"></object>
is solution.but did´t found solution swap them dynamcly in body div tag.
another option load via jquery:
$("#subpage_id").click(function() { $.getscript("js/subservice.js"); $("#body").load("./subpage.html"); });
this solution loads html , styles wont js (which dumb because wont load controller js)
Comments
Post a Comment