如何从modal html调用函数?

问题描述 投票:0回答:1

我尝试在我的模态中执行此操作:

<td colspan="4" class="text-center">{{$rootScope.getDate(proposal.date_from)}}</td>

<td colspan="4" class="text-center">{{getDate(proposal.date_to)}}</td>

第一个td输出没有第二个td输出{{getDate(proposal.date_to)}}作为字符串如何正确调用函数?它们在两个范围内定义

javascript angularjs
1个回答
0
投票

在你的控制器中将你的getDate函数附加到$scope,它应该是这样的:$scope.getDate = function(date) { ... }。在此之后,您可以使用以下格式调用getDate<td colspan="4" class="text-center">{{getDate(proposal.date_to)}}</td>

© www.soinside.com 2019 - 2024. All rights reserved.