【发布时间】:2018-04-10 15:14:34
【问题描述】:
我正在使用this jquery 插件来使 div 的高度相同。为了使插件工作,我必须将equalheight 添加到我想要具有相同高度的 div 中。当 div 不是由 ng-repeat 生成时,它可以工作。
如何让ng-repeat生成的所有div都一样高?
html
<div class="col-md-4" ng-repeat="dept in mainCtrl.departments" ng-hide="filteredCareers.length == 0">
<div class="job_list_box" ng-class="{'equalheight': filteredCareers.length > 0 }">
<div class="job_list_icon">
<img ng-src="{{dept.icon}}" alt="{{dept.name}}">
</div>
<h4 class="job_list-box-title">{{dept.name}}</h4>
<ul class="job_list">
<li ng-repeat="hiring in mainCtrl.careers | filter:dept.name as filteredCareers">
<a href="#" data-toggle="modal" data-target="#job-modal-{{hiring.id}}">{{hiring.name}}</a>
</li>
</ul>
</div>
</div>
控制器
var app = angular.module('myApp', [])
app.controller('MainController', function ($scope, $http) {
var self = this;
$http({
method: 'GET',
url: 'json/departments-archives.json'
}).then(function (response) {
self.departments = response.data;
}, function () { console.log('Error'); });
$http({
method: 'GET',
url: 'json/careers-archives.json'
}).then(function (response) {
self.careers = response.data;
}, function () { console.log('Error'); });
});
我尝试使用setTimeout,然后我在带有job_list_box 类的div 上添加了{{mainCtrl.setHeight}},但它不起作用。
setTimeout(function(){
self.setHeight = "equalheight"
},100)
我还尝试了我在网上找到的其他解决方案,例如角度插件 angular-vertilize、flexbox 方法..等等,但都没有奏效。
【问题讨论】:
标签: javascript jquery html css angularjs