Created
January 27, 2015 21:07
-
-
Save IgorDePaula/e07bf6338d4709a152b6 to your computer and use it in GitHub Desktop.
Preencho cada posicao celular com um conteudo diferente
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!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":" " | |
| }, | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| } | |
| ], | |
| [ | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| } | |
| ], | |
| [ | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| }, | |
| { | |
| "nome":" " | |
| } | |
| ] | |
| ]; | |
| $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