Hi Gustavo,
Sure there is. Strangly angular does not provide it out of the box. put the
following code in a service or directive whatever you see fit.
$scope.getData = function(formName) {
var els =
Array.prototype.slice.call($document[0].forms[formName].elements)
.filter(hasModel)
.map(extractModelController)
.filter(onlyValidModels)
console.log('result', els);
return els;
function onlyValidModels(ngModel) {
return ngModel.$valid;
}
function extractModelController(el) {
return angular.element(el).controller('ngModel');
}
function hasModel(el) {
return el.hasAttribute('ng-model');
}
}
Does that help?
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.