Whenever the following sequence of events occurs, my application seems to malfunction.
- Upon clicking on a user and assigning them a role, the page refreshes.
- A separate GET request retrieves a list of all users currently in the class.
- After selecting exactly 6 different individuals, my entire site stops working and prevents me from transitioning to another state. Additionally, all information on the current page vanishes abruptly.
<div ng-controller="class" data-ng-init="getAllUsers()">
<div class="col-md-6">
This is where all the users are displayed
<table ng-table="zz">
<tr ng-repeat="user in $data |filter: { _class: '!' + classEdit }">
<td>
<div class="radio">
<label><input type="radio" name="userN" ng-click="userId(user._id)">{{user.firstname}} {{user.lastname}} </label>
</td>
</tr>
</table>
</div>
<div class="col-md-6">
<p>What type of account? </p>
<div class="radio">
<label><input type="radio" name="userRole" ng-model="userRole" value="teacher">Teacher</label>
</div>
<div class="radio">
<label><input type="radio" name="userRole" ng-model="userRole" value="ta">TA</label>
</div>
<div class="radio">
<label><input type="radio" name="userRole" ng-model="userRole" value="student">Student</label>
</div>
<button type="submit" ng-click="updateClass()" class="btn btn-info">Add To Class</a>
</div>
$scope.updateClass = function() {
$state.transitionTo($state.current, $stateParams, {
reload: true, inherit: true, notify: true
});
$http({
method: 'POST',
url: '/updateClass',
data: {userRole:$scope.userRole,
userId:$scope.userUpdate,
Id:$rootScope.classEdit
}
}).then(function(result) {
});
};
If there's a more efficient way to handle the refresh, I am open to suggestions.