Accessing the form in the controller - AngularJS

Question regarding coding the right way with forms in angularJS.

I want to access the form in the controller. How can I achieve it without accessing the form name in the controller like that $scope.formName?

Do it like that tightly coupled the view and the controller.

Thanks!

Try to send the form name to the controller

<button type="button" ng-click="validateForm('myForm')">
    Validate
</button>

In controller

$scope.validateForm = function(formName) {
    var form = $scope[formName];
    form.$valid;
};