I can't retrieve the parameters with ng-submit
in a dynamic form submit.
.
Screenshot:
Show code:
(function() {
'use strict';
angular.module('starter.controllers')
.controller('MessagesCtrl', msgs);
function msgs() {
console.log('Loading MessagesCtrl!');
var vm = this;
vm.doMessage = function(_form) {
if (_form.$valid) {
console.log(_form);
// Who get parameters dynamic to POST?
}
};
};
})();
Html form
<form name="submitForm" no-validate="" ng-submit="vm.doMessage(submitForm)">
<div class="responsive-grid-break list list-inset padding-1">
<h1>Enviar uma mensagem</h1>
<label class="item item-input">
<span class="input-label">For</span>
<div class="item-input">
<i class="icon ion-search placeholder-icon"></i>
<input type="search" name="search" ng-model="msg.search" placeholder="..." />
</div>
</label>
<label class="item item-input">
<span class="input-label">Message</span>
<div class="separator item-input">
<textarea name="msgtext" ng-model="msg.text" placeholder="This message."></textarea>
</div>
</label>
<div class="list list-inset">
<div class="padding">
<button class="button button-block button-royal" type="submit">Send</button>
</div>
</div>
</div>
</form>
Usually, you use Angular to bind inputs to models, and you have access to those models from within your controller:
and controller: