I´m trying to include a HTMl page with the ng-include directive into a div in my Main HTML.
Main HTML:
<div class="col-sm-9" data-ng-include="'subPage.html'">
</div>
This SubPage is displayed correclty in the given div. Additionaly the subPage contains a script which contains some angular methods. Which i Added in the Header of SubPage.
<script type="text/javascript" src="js/subService.js"></script>
Calling the Page with
localhost:8080/subPage
Allowes me to use all functions and linked functions from the controller.
But when included via ng-include the Script will not even load which ofc results in no functionality. (checked in console)
Both MainPage and SubPage contain a ng-app directive and are both full standalone HTML.
Does anyone have a idea how to do this?
UPDATE
Like said in the answers
<object name="subPage" type="text/html" data="./subPage.html"></object>
Is a solution.But I did´t found a solution to swap them dynamcly in my body div tag.
Another Option is to load via Jquery:
$("#subpage_id").click(function() {
$.getScript("js/subService.js");
$("#body").load("./subPage.html");
});
This solution loads the HTMl and Styles but wont any js (which is dumb because it wont load my controller js)