I've recently developed a new auction form where users are required to fill in all the necessary fields. By clicking on the "Invite People" button, they can invite other saved users or send invitations via email. While the email functionality is working smoothly, I'm encountering some issues with the user invitation feature.
Here's the HTML section:
<div ng-show="showBid" class="panel panel-default" ng-controller="NewAuctionController">
<div class="panel-heading">Invite Members</div>
<div class="panel-body">
<ul class="list-group" ng-repeat="user in users">
<li class="col-md-4" id="userlist" ng-hide="user.name == profile">
<img ng-src="{{user.img}}" class="userImage">
<div class="username"> {{user.name}}</div>
<div class="userrole"> {{user.role}} </div>
<div class="usercompany">{{user.company}}</div>
<input type="checkbox" ng-model="user.isChecked" ng-click="insertinvited(user)">
</li>
</ul>
I have also attempted using ng-change, but encountered the same issue. The function insertinvited() is as follows:
$scope.invitations=[];
$scope.insertinvited= function (user) {
if(user.isChecked) {
$scope.invitations.push(user.name);
} else {
var toDel = $scope.invitations.indexOf(user.name);
$scope.invitations.splice(toDel,1);
}
console.log($scope.invitations);
};
When I check the array in the console, it seems to be working fine as expected.
However, when I attempt to use that array here:
<div ng-show="showBid" class="panel panel-default" >
<div class="panel-heading">Members Selected:</div>
<div class="panel-body">
<ul class="list-group">
<li class="list-group-item" ng-repeat="invitation in invitations">
<div class="listmail"> {{invitation}}</div>
</li>
</ul>
</div>
</div>
The array appears to be empty, as when I pass the array to the controller and try to log it, it shows up as empty. Could anyone provide assistance?
Edit:
This is my complete HTML code:
... (Continued text)And this is my entire controller:
... (Continued text)});