Skip to content

Commit

Permalink
Cleans up missing randomcolor module
Browse files Browse the repository at this point in the history
  • Loading branch information
austinpray committed Jun 29, 2014
1 parent cf410ff commit 97f9588
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
<script src="scripts/app.js"></script>
<script src="scripts/config.js"></script>
<script src="scripts/controllers/main.js"></script>
<script src="scripts/services/randomcolor.js"></script>
<script src="scripts/services/injectstyles.js"></script>
<!-- endbuild -->
</body>
Expand Down
12 changes: 7 additions & 5 deletions app/scripts/controllers/main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
'use strict';

angular.module('proGridApp')
.controller('MainCtrl', ['$scope', 'hostname', 'injectStyle', function ($scope, hostname, injectStyle) {
.controller('MainCtrl', ['$scope', '$timeout', 'hostname', 'injectStyle', function ($scope, $timeout, hostname, injectStyle) {
var socket = io.connect(hostname);
// Socket listener for updating grid
var userColor = '';
var apiKey = 1;
var updateGrid = function(row, col, color) {
$scope.gridArray[row][col].color = !!$scope.gridArray[row][col].color ? '' : color;
$scope.$apply();
$timeout(function () {
$scope.gridArray[row][col].color = !!$scope.gridArray[row][col].color ? '' : color;
}, 0);
};

socket.on('server ready', function (data) {
Expand All @@ -19,8 +20,9 @@ angular.module('proGridApp')
console.log(message);
userColor = data.userColor;
injectStyle.gridDimensions(data.gridArray.length);
$scope.gridArray = angular.copy(data.gridArray);
$scope.$apply();
$timeout(function () {
$scope.gridArray = angular.copy(data.gridArray);
}, 0);
});

socket.on('fresh api key', function (data) {
Expand Down

0 comments on commit 97f9588

Please sign in to comment.