I want to access the dynamic form name in controller. Here is my code:
HTML
<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>
</form>
CONTROLLER
angular.module("myApp",[]).controller("myCtrl",function($scope) {
$scope.myForm= "validateForm";
console.log("form" + $scope.myForm)
});
I want $scope.myForm should print the form object but it prints the string "validateForm"
$scope.name?$scope.myForm = "validateForm";. What exactly did you expect that$scope.myFormwould print actually? Something different fromvalidateForm? Because if it was something different then I would be puzzled. Wouldn't you?