gpt4 book ai didi

javascript - Jquery 对话框未使用 Angular 范围填充

转载 作者:行者123 更新时间:2023-12-02 15:56:11 24 4
gpt4 key购买 nike

第一次启动对话框时,以下代码似乎不起作用。

        $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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com