我有一些我在一个范围变量中定义的javacript函数,如下所示:
$scope.salma = {
selectedRestaurants: accounts.selectedRestaurants,
findAllAccountsByRestaurant: function(restaurant) {
angular.forEach(accounts.AllRestaurantAccounts, function(CurrentAllrestaurantAccount) {
if(CurrentAllrestaurantAccount.nameRestaurant === restaurant) {
accounts.currentRestaurantNumberAllAccount = CurrentAllrestaurantAccount.accountNumber;
}
});
return accounts.currentRestaurantNumberAllAccount;
},
findAccountsOptInMAIL: function(restaurant) {
angular.forEach(accounts.AllOptInMAILRestaurantAccounts , function(CurrentAllrestaurantAccountOptInMAIL) {
if(CurrentAllrestaurantAccountOptInMAIL.nameRestaurant === restaurant) {
accounts.currentRestaurantNumberOptInMAIL = CurrentAllrestaurantAccountOptInMAIL.accountNumber;
}
});
return accounts.currentRestaurantNumberOptInMAIL;
}
};
我在我的html中调用了这些函数,如下所示:
<tbody>
<tr ng-repeat="restaurant in salma.selectedRestaurants">
<td>{{ restaurant }}</td>
<td>{{ salma.findAllAccountsByRestaurant(restaurant) }}</td>
<td>{{ salma.findAccountsOptInMAIL(restaurant) }}</td>
</tr>
</tbody>
第一个功能在html中生效但第二个功能没有生效,我不知道为什么。请问有什么建议吗?