<script>
angular.module("listaTelefonica", []);
angular.module("listaTelefonica")
.controller("listaTelefonicaController", function($scope){
$scope.app = "Lista Telefonica";
$scope.contatos = [
{nome:"Pedro", telefone:"9999999988"},
{nome:"Ana", telefone:"9999999977"},
{nome:"João", telefone:"9999999966"},
];
$scope.adicionarContato = function(){
consoe.log($scope.nome);
};
});
</script>
<body ng-controller="listaTelefonicaController">
<div class="jumbotron">
<h3 ng-bind="app"></h3>
<table class="table table-striped">
<tr style="text-align: center;">
<th>Nome</th>
<th>Telefone</th>
</tr>
<tr ng-repeat="contato in contatos">
<td>{{contato.nome}}</td>
<td>{{contato.telefone}}</td>
</tr>
</table>
<hr/>
<input class="form-control" type="text" ng-model="contato.nome" placeholder="Nome" /><br/>
<input class="form-control" type="text" ng-model="contato.telefone" placeholder="Telefone" /><br/>
<button class="btn btn-primary btn-block" ng-click="adicionarContato()">Adcionar Contato</button>
</div>
</body>
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help, check https://xhr.spec.whatwg.org/.
ReferenceError: consoe is not defined
at Scope.$scope.adicionarContato (index.html:33)
at $parseFunctionCall (angular.js:12404)
at callback (angular.js:21566)
at Scope.$eval (angular.js:14466)
at Scope.$apply (angular.js:14565)
at HTMLButtonElement. (angular.js:21571)
at HTMLButtonElement.eventHandler (angular.js:3032)