获取ng-repeat的父div的高度并将其设置为另一个div高度 [英] Get the height of parent div of ng-repeat and set it to another div height

查看:106
本文介绍了获取ng-repeat的父div的高度并将其设置为另一个div高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的代码



 <   div     class   =  border_box >  < ;   / div  >  
< div id = MainDiv >
< div id = ObjAccordian ng-repeat = GuideDetails中的指南 init = refresh(); >
---我的代码
< / div >
< / div >





我想得到MainDiv的高度并将高度设置为BorderBox高度

解决方案

您可以将ng-style与函数一起使用并解析div的选择器进行复制:



 <   script     type   =  text / javascript >  
var myApp = angular.module(' myApp',[])

myApp.controller(' myController' ['


scope', function

范围){

Below is my code

<div class="border_box"></div>
<div id="MainDiv">
     <div id="ObjAccordian" ng-repeat="guide in GuideDetails" init="refresh();">
                                ---my code 
     </div>
</div>



I want to get the Height of MainDiv and set the height to BorderBox Height

解决方案

You could use ng-style with a function and parse the selector of the div to copy:

<script type="text/javascript">
var myApp = angular.module('myApp',[])

myApp.controller('myController'['


scope',function(


scope){


这篇关于获取ng-repeat的父div的高度并将其设置为另一个div高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆