【发布时间】:2015-09-29 15:26:54
【问题描述】:
我的 AngularJS 应用程序中有一个通知下拉菜单。我想在打开下拉列表的函数中调用一个函数。这就是我的意思:
$scope.showNotif = false;
$scope.toggleNotifDropdown = function(event) {
$scope.showNotif = !$scope.showNotif;
readNotifications = function() {
NotificationService.readNotifs().then(
function(success) {
console.log("Notifications read!");
},
function(errors) {
console.log("Something wrong happened.");
}
);
};
if($scope.showNotif) {
$document.bind('click', $scope.globalNotifClose);
} else {
$document.unbind('click', $scope.globalNotifClose);
}
event.stopPropagation();
};
通知下拉菜单完美运行,我只是无法让 readNotifications() 函数为我工作。任何建议都会很棒!谢谢!
【问题讨论】:
-
你有没有调用过
readNotifications()?
标签: angularjs function methods callback