0
The Create ctrl controller is not seeing the ng-model input of my form. I can pass values from the controller to the view but I’m not getting the reverse. Where am I going wrong?
Controller:
.controller('CriarCtrl', function ($scope) {
$scope.criarDemanda = function () {
console.log($scope.name);
}
})
View:
<input type="text" ng-model="name" name="nome" required />
<button class="button button-assertive button-block activated" ng-click="criarDemanda()">Enviar</button>
Try to do that:
ng-click="criarDemanda(name)"
and on your controller:$scope.criarDemanda = function (name)
and thenconsole.log(name)
– DiegoAugusto
I understood but I have 20 inputs and I want to send all ng-models to the controller at the click of the button. It would be correct to send an array with all?
– David Coelho
The ideal is to have an object with all the properties. So the way @Techies said you would pass only the object "person".
– Pedro Camara Junior