Hello
In the form of html
I do the following:
<div class="container jumbotron" ng-controller="crudCtrl">
<form role="form">
<div class="form-group">
<label for="nome">Nome:</label>
<input type="text" class="form-control" ng-model="nome" id="">
</div>
<div class="form-group">
<label for="sexo">Sexo:</label>
<input type="text" class="form-control" ng-model="sexo" id="sexo">
</div>
<div class="form-group">
<label for="data">Data Nascimento:</label>
<input type="text" class="form-control" ng-model="dataNascimento" id="data">
</div>
<div class="form-group">
<label for="pais">País:</label>
<input type="text" class="form-control" ng-model="pais" id="pais">
</div>
<button class="btn btn-default" ng-click="Cadastrar()">Salvar</button>
</form>
</div>
And do not angle the following:
var app = angular.module("crud", []);
app.controller("crudCtrl", function ($scope) {
$scope.Cadastrar = function(data) {
$scope.MostrarTabela = true;
$scope.nome = data.nome;
$scope.sexo = data.sexo;
$scope.datanasc = data.dataNascimento;
$scope.pais = data.pais;
}
});
Is the way I'm sending the data to controller
wrong?
Because it displays the following error:
Can not read property 'name' of undefined