angular iFrame加载资源问题

index-oupt.html(主框架 doctorstation-outp-controller.js)等到加载完成患者列表的内容,然后加载就诊史的内容

<!--就诊史outp-visit-history-->
<section class="tab-pane active visit-history-index" ng-show="tabNavShow.visitHistory"
     ng-include src="'templates/visitHistory/visit-history-page.html'">
</section>
<!--患者列表开始-->
<section ng-show="clinicTimeShow" class="pat-list-index hc-sidebar hc-float-above border-radius outp-pat-list-index"
     ng-include src="'templates/outp/outp-left.html'">
</section>

doctorstation-outp-controller.js

$scope.waitIframeLoad = function() {
    console.log("invoke waitIframeLoad!");
    //var iframes = ["visitHistoryFrame", "outpAdmissionFrame", "outpClinicAppointFrame"];
    var iframes = ["visitHistoryFrame"];
    if ($scope.doctorstationParaValue.enableDaywardApply === '1') {
        iframes.push("outpOperationApplyFrame");
    }
    var loaded = iframes.every(function (id) {
        return document.getElementById(id).contentWindow.document.readyState === "complete";
    });
    if (loaded) {
        console.log("iframesLoaded!");
        $scope.waitIframeLoad = undefined;
        $scope.$broadcast($scope.updatePatientEvent);
    }else{
        setTimeout(function () {
            waitIframeLoad();
        }, 1000)
    }
}

visit-history-page.html (visit-history-page-controller.js)

<div ng-controller="VisitHistoryPageController"  hr-self-height="$(window).height() - 99">
    <iframe 
        
        ng-src="{{visitHistoryView.url}}"
        scrolling=yes
        frameborder=0 marginheight=0 marginwidth=0 >

    </iframe>
</div>

visit-history-page-controller.js

var VisitHistoryPageController = ["$scope", function ($scope) {
    $scope.visitHistoryView = {
        "url": Path.getUri("doctorstation/index-visit-history.html?" +
            "&departmentCode=" + $scope.doctorInfo.departmentCode +
            "&allowViewReportStatus=" + $scope.doctorstationParaValue.allowViewReportStatus +
            "&fromPage=doctorStation")
    };
  window.addEventListener('message', function (event) {
  if (event.data.type === "apply-for-admission-order") {
   hrDialog.dialog(hrDialog.typeEnum.WARN, {title: '提示!', message: "请开立院前医嘱!"})
   .close(function(){
  $scope.showAdmissionTabNav("admissionOrder");
  })
   }
});<!--接收iframe加载页面的消息-->
    $scope.$on($scope.updatePatientEvent, function () {
        setTimeout(function () {
            document.getElementById("visitHistoryFrame").contentWindow.postMessage({
                type: "update-patient-event",
                body: {
                    patientId: $scope.patientInfo.patientId
                }
            }, "*");
        }, 500);
    });
}];

index-visit-history.html(visit-history-app.js)

<!DOCTYPE HTML>
<html ng-app="VisitHistoryApp">
<head>
    <meta charset="utf-8">
    <title>就诊史</title>
</head>
<body>
    <div ng-include src="'templates/visitHistory/visit-history.html'"></div>
</body>
</html>

visit-history-app.js没有什么信息

visit-history.html (visit-history-controller.js)

<!--就诊史-->
<div class="visit-history-index" hr-cloak ng-controller='VisitHistoryController'>
<div>

visit-history-controller.js

var VisitHistoryController = ["$scope" ,function ($scope) {
  function getQueryString(queryString, name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = queryString.substr(1).match(reg);
    if (r != null) {
        return decodeURI(r[2])
    }
    return null;
    }
//获取放iframe窗口那一级的页面元素
var scope = parent.angular.element("#outpMrMain").scope();
  window.parent.postMessage({
  type: "apply-for-admission-order",
  body:""
}, "*");<!--像父窗口发消息-->
 () {
      $scope.pageInfo.from = getQueryString($window.location.search, "fromPage");//获取上面绿色传过来的值
      window.addEventListener('message', function (event) {<-- iFrame之间通信 -->
          console.log("---------从iframe传来数据---------------");
          console.log(event.data.body);
          if (event.data.type === "update-patient-event") {
              initParam();
              $scope.outpMrSearchCondition.patientId = event.data.body.patientId;
              initVistitHistoryContr();
          }
      });
  })();
}];