Why can’t I get the form data?

Asked

Viewed 35 times

0

Something really weird is happening, first time this happens. I have a registration form. when I click save, the console appears 'Undefined' and aligns... Impossible to be 'Undefined' because there are data filled in!!! See below:

HTML

<form name="formAddress" ng-controller="InicialCtrl">
    <label>Nome do estabelecimento</label>
    <input class="form-control" type="text" name="name" mg-model="estabele.nome">

    <label>CEP</label>
    <input class="form-control" type="text" name="cep" mg-model="estabele.cep">

    <label>Endereço</label>
    <input class="form-control" type="text" name="address" mg-model="estabele.and" >

    <label>Cidade</label>
    <input class="form-control" type="text" name="city" mg-model="estabele.cidade" >

    <label>UF</label>
    <input class="form-control" type="text" name="uf" mg-model="estabele.uf" >

    <label>Contato</label>
    <input class="form-control" type="text" name="phone" mg-model="estabele.telefone">

    <button class="btn btn-block btn-primary btnRegister" ng-click="cadastro(estabele)">Cadastrar</button>
</form>

controller:

app.controller("InicialCtrl", ['$scope', '$http', '$window', '$location', '$rootScope', function ($scope, $http, $window, $location, $rootScope) {

$scope.cadastro = function(estabele){
    console.log(estabele);
}

}]);

1 answer

3


Why are you wearing mg-model rather than ng-model.

  • It’s really old... thanks... I think that from writing these directives so much, we write so fast that we do not realize when we write wrong and then we kill ourselves to find the problem thinking that everything is right and we do not look at the most obvious things kkkkk .

  • 1

    I share these hahahaha slips

Browser other questions tagged

You are not signed in. Login or sign up in order to post.