gpt4 book ai didi

javascript - Angularjs:从 $scope 场景中提取显示数据

转载 作者:行者123 更新时间:2023-12-03 03:46:13 26 4
gpt4 key购买 nike

我有以下 ng-repeat 调用,它在前端显示平面“AVAILABLE”或“FULL”。需要通过修改 html 以从 $scope 读取来使其更加动态。

<tbody>
<tr ng-repeat="hour in workhours">
<td >{{hour}}:00 - {{hour+1}}:00</td>
<td ng-class="{'full' : !entry.HoursAvailable.includes(hour)}"
ng-click="checkSlotAvailability(hour, jobLength, entry, data)"
ng-repeat="entry in data.calendar" >
{{entry.HoursAvailable.includes(hour) ? 'AVAILABLE' : 'FULL'}}
</td>
</tr>
</tbody>

我想从controller.js中的$scope.data.response读取响应来代替“AVAILABLE”

最佳答案

你可以这样做

<span ng-if="entry.HoursAvailable.includes(hour)"> 
{{ data.response }}
</span>
<span ng-if="!entry.HoursAvailable.includes(hour)">
FULL
</span>

关于javascript - Angularjs:从 $scope 场景中提取显示数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45378895/

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