I have more than three dynamically generated forms. I need to repeat all form errors in the controller. I assign forms names using models.
<form name="{{myForm}}" novalidate>
<input type="text" ng-model="username" name="username" required/>
<span ng-show="(submit && myForm.username.$error.required)">
<span>Required</span>
</span>
angular.module("myApp",[]).controller("myCtrl",function($scope) {
$scope.myForm= "validateForm";
console.log("form" + $scope.myForm)
});
What I want, when I console $scope.myForm, it should print the form object, but what happens is that it just prints the line "validateForm".
source
share