I have a simple 4x4 table and a 4x1 table. The 4x4 table a table of white squares. The 4x1 table is a list of 4 colors. Ideally, I'd like to click on an element in the 4x1 table (a color) and click on an element in the 4x4 table and change the background color of that particular element, not the entire 4x4 table. So, if I click on the color blue, and then block (2,2), then block (2,2) will change to blue. Right now, this is what I have:

<table>
<td ng-style="{'background-color':'blue'}"></td>
<td ng-style="{'background-color':'green'}"></td>
<td ng-style="{'background-color':'orange'}"></td>
<td ng-style="{'background-color':'red'}"></td>
</table>
So here, I know I must add some identifier for the colors to capture them, but I am not certain how at the moment.
<table>
<tr>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
</tr>
<tr>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
</tr>
<tr>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
</tr>
<tr>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
<td ng-style="getColor()" ng-click="changeColor()"></td>
</tr>
</table>
And here, I have a table where I am hoping to use getColor to set the color value, initially blank or white, and changeColor to change that.
At this very moment, getColor looks like:
$scope.getColor = function(){
return{
"background-color":"white"
}
}
And changeColor looks like:
$scope.changeColor = function(){
return{
"background-color":"'"+$scope.newColor+"'"
}
}
Of course, this does not work for a variety of reasons, but I would like to know how to get the simple functionality that I am hoping for.
getColor()