I have created a chatbox in angular JS and now I want to show notification bubble when ever I click on any user. I tried to use this with ng-click and and ng-if but failed. Here is the code I am using
<div class="people" >
<div ng-repeat="user in allCompanyUsers">
<div class="person" ng-click="activateChat(user)" id="chat_{{user.id}}">
<img alt="" />
<span class="name" >{{user.firstName}} {{user.lastName}}
<span ng-show="!user.showNotification" class="noti_bubble">5</span>
<span class="preview"></span>
</div>
</div>
</div>
And on controller side:
$scope.showNotification = false;
$scope.allCompanyUsers = AllCompanyUsers.query();
$scope.activateChat = function(user){
console.log(user);
$scope.activeConversations = [];
UserMessages.query({toUser:user.login}).$promise.then(function(data) {
angular.forEach(data, function(message) {
$scope.activeConversations.push({'message':message.message,'type':message.type, 'time': message.time});
});
});
$scope.activePerson=user.login;
$scope.showNotification = true;
$scope.isDisabled=true;
/*$scope.activeConversations=user.chat;*/
$('.left .person').removeClass('active');
var el = angular.element( document.querySelector('#chat_'+user.id));
el.addClass('active');
};
Currently the count is hardcoded. Here All users are showing with 5 bubble but I want that only selected user will show the bubble...
any kind of help is appreciated. Thanks in advance