zoukankan      html  css  js  c++  java
  • Angular分模块部署到docker

    以Portal与login模块为例子

    Portal的Controller中:

    var nodeIp ="localhost";
    var htmldata = '<iframe height="1500" class="container col-sm-12 " style="border:0px " src="http://' + nodeIp + ':3002/index"></iframe>';
    
    //src为login模块首页地址,3002为login模块所在端口
    
    $scope.html = htmldata;
    $scope.visible = !$scope.visible;
    

      

    index.html中:

    <div class="form-group-my" ng-show="visible" compile="html"></div>
    

      

    Login登录后将用户信息放入redis中,此时Portal需刷新才可获得redis中的用户信息,即Login需向Portal模块返回信息

    涉及到iframe跨域问题,子页需要调用父页的刷新方法,百度找到解决问题

    Login的Control中登录之后:

    if(typeof(exec_obj)=='undefined'){
    exec_obj = document.createElement('iframe');
    exec_obj.name = 'tmp_frame';
    exec_obj.src = 'http://localhost:3000/public/views/execA.html';
    
    //src为Portal模块首页地址,3000为Portal模块端口
    exec_obj.style.display = 'none';
    document.body.appendChild(exec_obj);
    
    }else{
    exec_obj.src = 'http://localhost:3000/public/views/execA.html?' + Math.random();
    }
    

      

    在Portal模块中新建文件exeA.html

    内容为下:

    <script type="text/javascript">
    parent.parent.test();// execute parent myframe fIframe function
    </script>
    
    Portal中的index.html加入以下:
    
    <script type="text/javascript">
    
    function test() {
    window.location.reload();
    
    };
    
    </script>
    

      

    此时当登录完成后Portal首页会刷新,即可从redis中取出用户信息

    参考地址: http://blog.csdn.net/fdipzone/article/details/17619673

  • 相关阅读:
    线程数量与并行应用性能相关性的测试
    redis命令学习
    shell获取日期(昨天,明天,上月,下月)
    shell获取文件行数
    redis的备份和恢复
    redis使用Java学习
    kafka的一些常用命令
    查看kafka的group.id
    vim搜索后跳到下(上)一个
    redis批量执行
  • 原文地址:https://www.cnblogs.com/lww930/p/5241028.html
Copyright © 2011-2022 走看看