randomize default avatar
This commit is contained in:
@@ -185,11 +185,12 @@ app.controller('StepController', ['$scope', '$location', 'Wizard', function ($sc
|
||||
|
||||
// ensure image got loaded before setting the preview avatar
|
||||
var image = document.createElement('img');
|
||||
var randomIndex = Math.floor(Math.random() * $scope.wizard.availableAvatars.length);
|
||||
image.onload = function() {
|
||||
$scope.$apply(function () { $scope.wizard.setPreviewAvatar($scope.wizard.availableAvatars[0]); });
|
||||
$scope.$apply(function () { $scope.wizard.setPreviewAvatar($scope.wizard.availableAvatars[randomIndex]); });
|
||||
image = null;
|
||||
};
|
||||
image.src = $scope.wizard.availableAvatars[0].data || $scope.wizard.availableAvatars[0].url;
|
||||
image.src = $scope.wizard.availableAvatars[randomIndex].data || $scope.wizard.availableAvatars[randomIndex].url;
|
||||
}]);
|
||||
|
||||
app.controller('FinishController', ['$scope', '$location', '$timeout', 'Wizard', 'Client', function ($scope, $location, $timeout, Wizard, Client) {
|
||||
|
||||
Reference in New Issue
Block a user