第一次启动对话框时,以下代码似乎不起作用。
$scope.ke_location_channel_summary = function (region_id, region) {
$scope.region_data = $scope.location_channel_data[region_id];
killed_enquiries_services.open_dialog('popup', region);
$('#popup').html($('#location_channel_summary').html());
};
但它适用于以下更改
$scope.ke_location_channel_summary = function (region_id, region) {
$scope.region_data = $scope.location_channel_data[region_id];
window.setTimeout(function () {
killed_enquiries_services.open_dialog('popup', region);
$('#popup').html($('#location_channel_summary').html());
}, 0);
};
代码的 HTML 部分是
<div id="location_channel_summary" style="display: none">
<table class="standardTable">
<tr>
<th class="left-col-heading">Channel</th>
<th class="center">Qty</th>
<th class="center">Nights</th>
<th class="center">Value</th>
<th class="center">Avg Value</th>
<th class="center">ADR</th>
</tr>
<tr ng-repeat="ctype in contacttypes | orderBy:['sort_order']">
<td style="width:25%;" class="left-col-td">{{ctype.name}}</td>
<td ng-repeat="column in columns" class="center">{{region_data[ctype.id][column]}}</td>
</tr>
</table>
我正在尝试在 Jquery 对话框上显示 div 内容。返回的表包含空白内容,没有 setTimeOut。为什么会这样?
最佳答案
这可能是因为 AngularJS 观察器是异步的,需要一些时间来解析 {{ctype.name}}
和 {{region_data[ctype.id][column]}}
表达式。
关于javascript - Jquery 对话框未使用 Angular 范围填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31539837/