Skip to content

Instantly share code, notes, and snippets.

@IgorDePaula
Created January 27, 2015 21:07
Show Gist options
  • Select an option

  • Save IgorDePaula/e07bf6338d4709a152b6 to your computer and use it in GitHub Desktop.

Select an option

Save IgorDePaula/e07bf6338d4709a152b6 to your computer and use it in GitHub Desktop.
Preencho cada posicao celular com um conteudo diferente
<!DOCTYPE html>
<html ng-app="App">
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
table{
border:1px solid red;
border-collapse: collapse;
}
td{
border:1px solid red;
}
</style>
<script src="js/libs/angular.js/angular.js"></script>
<script>
angular.module('App', [])
.controller('Teste', function ($scope) {
var obj = [
[
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
}
],
[
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
}
],
[
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
},
{
"nome":"&nbsp;"
}
]
];
$scope.obj = obj;
$scope.addMat = function(){
$scope.obj[1][2].nome = "Matematica";
$scope.obj[0][3].nome = "Matematica";
}
$scope.addAlg = function(){
$scope.obj[0][2].nome = "Algebra";
$scope.obj[0][0].nome = "Algebra";
$scope.obj[2][4].nome = "Algebra";
}
});
</script>
</head>
<body ng-controller="Teste">
<table>
<tr ng-repeat="row in obj track by $index">
<td ng-repeat="cell in obj[$index]">{{cell.nome}}</td>
</tr>
</table>
<a ng-click="addMat()">Matematica</a>
<a ng-click="addAlg()">Algebra</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment