I want to access the dynamic form name in the 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 to print the form object, but it prints the string "validateForm"
source
share